• Forum
  • Lounge
  • G++4.9 - Why do I still need -std=c++11?

 
G++4.9 - Why do I still need -std=c++11?

Title says it all: What's the point? Does turning on C++11 break C++03 code? If not, seems like compiling with C++11 on should just be the default now.
compiling with C++11 on should just be the default now.
Why not C++14?

Does turning on C++11 break C++03 code?
Yes, this:
auto int x = 0;
/s

Honestly, it took more than 25 years to dinally introduce automatic type deduction into language. No surprise that implementers are slightly slow too.
Why not C++14?

Because that's not anywhere near fully implemented in G++4.9. C++11 is.

Your example isn't what I mean. I mean, if you compile C++03 conformant code with -std=c++11, will the code break? You're giving an example of C++11 code not compiling under a non-C++11 compiler, which of course will not work.
No, I gave an example of valid C++03 code which is not compiling under C++11 as meaning of auto changed here. http://ideone.com/7At8MJ
I even marked that line as sarcasm...

I never saw code using auto before C++11 (or in C for that matter).
C++11 in Gcc is still incomplete:
https://gcc.gnu.org/projects/cxx0x.html
https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x
Because of that it is probably still not default mode.
I have seen the use of auto before type deduction! It was incorrectly used by someone who thought it deduced a type.

People, from my perspective, seem to enjoy stability over latest and greatest... sometimes even sacrificing stability for that stability. Humor aside, C++03 is old and stable. It's easy to write C++03 code that works across virtually every C++ compiler known to man... not so much so for C++11.
The default for GCC has never been any form of standard language anyway: the default C is "gnu89" and the default C++ is "gnu++98", with many extensions. We have to pass both -std and -pedantic to switch to a standard language.

Different vendors - different ideas about product delivery. Compare to Microsoft where there is pretty much no choice but to use the latest they could push out.
Even if C++11 was completely implemented would it really be worth breaking a lot of old build scripts? Luckily adding -std=c++11 yourself isn't hard to do.
Last edited on
Topic archived. No new replies allowed.