Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-std default value for GCC4.8.1

Tags:

c++

gcc

c++11

If I don’t specify the -std option when compiling my C++ app using GCC4.8.1, does it apply c++11 value by default?

I read the words from GCC document, but still not sure of that. My English is not good, so it might be my bad.

-fext-numeric-literals (C++ and Objective-C++ only) Accept imaginary, fixed-point, or machine-defined literal number suffixes as GNU extensions. When this option is turned off these suffixes are treated as C++11 user-defined literal numeric suffixes. This is on by default for all pre-C++11 dialects and all GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++1y. This option is off by default for ISO C++11 onwards (-std=c++11, ...).

like image 661
Dean Chen Avatar asked Jul 30 '13 06:07

Dean Chen


1 Answers

Update in 2018: in the newest version of gcc, the default option for -std is now -std=gnu++14.


From gcc standards 2.2 C++ language

The default, if no C++ language dialect options are given, is -std=gnu++98.

So if you want to enable C++11 features, you have to add the option -std=c++11 or -std=gnu++11 (for C++11 with GNU extensions)

like image 133
Yu Hao Avatar answered Oct 04 '22 20:10

Yu Hao