-std default value for GCC4.8.1

If I do not specify the -std when compiling my C ++ application using GCC4.8.1, is the default C ++ 11 applicable?

I read the words from the GCC document, but still not sure about it. My English is not very good, so it can be bad.

-fext-numeric-literals (C ++ and Objective-C ++ only) Accept imaginary, fixed, or machine-defined letter suffixes as GNU extensions. When this option is disabled, these suffixes are treated as C ++ 11 user-defined alphanumeric suffixes. This is enabled 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 disabled by default for ISO C ++ 11 (-std = C ++ 11, ...).

+4
source share
2 answers

2018 update: in the latest version of gcc, the default option for -std now -std=gnu++14 .


From gcc standards 2.2 C ++ language

By default, if C ++ dialects are not specified, this is -std = gnu ++ 98.

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

+10
source

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 someone wonders what happened to C ++ 03.

+2
source

Source: https://habr.com/ru/post/1494208/


All Articles