What are the differences between
What are the differences between -std=c++11
and -std=gnu++11
as compilation parameter for gcc and clang? Same question with c99
and gnu99
? I know about C++ and C standards, it's the differences in the parameters that interest me.
I've read somewhere that it has to do with some extensions but it is not clear to me which ones and how to choose between one or the other for a new project.
As you have found out yourself, the difference between the two options is whether GNU extensions that violates the C++ standard are enabled or not. The GNU extensions are described here. Note that some extensions can still be in effect when using -std=c++11
, as long as they do not contradict the standard.
For instance, when using the MinGW compiler, I need the extensions for a working Boost.Lexical_Cast
. But, as long as you don't use any of them, you are better off sticking to the standard without extensions for maximum portability. This might come in handy if you find yourself forced to change compiler.
上一篇: gcc / g ++和cc1 / cc1plus有什么区别?
下一篇: 有什么区别