简体   繁体   中英

-std default value for GCC4.8.1

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, ...).

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)

From the man-page:

  c++98 c++03 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. Same as -ansi for C++ code. gnu++98 gnu++03 GNU dialect of -std=c++98. This is the default for C++ code. 

Just if somebody wonders what happend to C++03.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM