Here's some simple code.
#include <iostream>
using namespace std;
bool func(char* m)
{
*m = '4';
return true;
}
using namespace std;
int main()
{
char c1 = '3';
cout << "a" << c1 << func(&c1) << c1 << "b" << endl;
return 0;
}
when compile this with g++ -O0 (4.7.2), output is a413b, for -O2, output is a414b. for clang++ 3.2, output is a314b.
Did I do anything undefined for c++ in this part of code?