Hi,
this might be g++-related but it raises a general question.
#include <iostream>
using namespace std;
bool getValue(int& val){
val=int(42);
return true;
}
int main(){
int i(0);
cout<< i<<" "<<getValue(i)<<" value "<<i<<endl; // (*)
}
Compiled with optimization (-O3) this yields the output
42 1 value 42Without optimization it gives
42 1 value 0I had expected
0 1 value 42Do I have to read the line (*) from right to left? But that seems odd
since "endl" is at the end of the output.
Ralf