Thursday, 24 March 2016

c++ - Difference of uninitialized values for g++ and g++14

If I compile and run a simple program in c++ like this:



int main(){

int x;
cout << x << endl;
}


and I compile in Linux saying g++ myProgram.cc (or g++ -std=c++14), I obviously get the ./a.out executable which works fine and the automatically initialized value 0 prints.



But if I compile my code with g++14 myProgram.cc, I get an error saying that x is uninitialized.



Is g++14 some sort of different version? I'm confused on why this is happening, thanks!

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...