Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Side effects of enabling C++0x support in gcc

Tags:

gcc

c++11

Following link, I'm wondering if there're some side effects of enabling C++0x in GCC.

According to gcc: "GCC's support for C++0x is experimental".

What I'm afraid of is that for example compiler will generate some code differently or standard library uses some C++0x feature which is broken in gcc.

So if I don't explicitly use any of C++0x features, may it break my existing code?

like image 991
dimba Avatar asked Jun 12 '11 19:06

dimba


People also ask

What is STD C ++ 0x?

C++0x was the working name for the new standard for C++, adding many language features that I'll cover in this series on C++11. In September 2011, C++0x was officially published as the new C++11 standard, and many compilers now provide support for some of the core C++11 features.

Does GCC 7.5 support C ++ 17?

GCC has had complete support for C++17 language features since version 8.

Why is GCC written in C++?

It's nearly a superset of C90, which GCC was then written in. The C subset of C++ is as efficient as C. C++ "supports cleaner code in several significant cases." It never requires "uglier" code. C++ makes it harder to break interface boundaries, which leads to cleaner interfaces.

Is C ++ 20 supported?

Full supportVisual Studio 2019 supports all C++20 features through its /std:c++latest option, as of version 16.10. 0. An option /std:c++20 to enable C++20 mode is added in version 16.11. 0.


1 Answers

The C++0x support has been, and is under heavy development. One thing this means is that bugs get fixed quickly, another thing it means is that there might be small bugs present. I say small, because of two reasons:

  1. libstdc++ has not been rewritten from scratch, so all the old elements are just as stable as it was before any of this c++0x was available, if not more stable, because of several years of bug fixes.

  2. There's corner cases in the new/old Standard that haven't yet been ironed out. Are these the runtime quirks you talk about? No. C++0x support has been under development for 4 releases now, don't worry.

Most of the impact from that flag will be felt in the new language features, the library features like move constructors and std::thread (on posix platforms) don't affect code not using them.

Bottom line, experimental is too strict a word in daily production. The standard has changed in the three/four years GCC has been working on support. Old revisions of c++0x will be broken in a newer GCC, but that's a good thing. C++0x is finished as far as the non-paying-for-a-pdf-world is concerned, so no breaking changes should be added. Decide if you want the new stuff or not beforehand, because you won't be able to jsut switch it off once you've gotten used to using it.

like image 150
rubenvb Avatar answered Oct 02 '22 12:10

rubenvb