The C++ standard defines rules about how programs should behave in specific circumstances. And in most cases, compilers will follow these rules. However, many compilers implement their own changes to the language, often to enhance compatibility with other versions of the language (e.g. C99), or for historical reasons. These compiler-specific behaviors are called compiler extensions.
Writing a program that makes use of a compiler extension allows you to write programs that are incompatible with the C++ standard. Programs using non-standard extensions generally will not compile on other compilers (that don’t support those same extensions), or if they do, they may not run correctly.
Frustratingly, compiler extensions are often enabled by default. This is particularly damaging for new learners, who may think some behavior that works is part of official C++ standard, when in fact their compiler is simply over-permissive.
Because compiler extensions are never necessary, and cause your programs to be non-compliant with C++ standards, we recommend turning compiler extensions off.
Disable compiler extensions to ensure your programs (and coding practices) remain compliant with C++ standards and will work on any system.
Disabling compiler extensions
From the Project dialog, first make sure the Configuration field is set to All Configurations.
Then, click C/C++ > Language tab, and set Disable Language Extensions to Yes (/Za).
Disable compiler extensions via Settings menu > Compiler > Compiler flags tab, then find and check the -pedantic-errors option.
You can disable compiler extensions by adding the -pedantic-errors flag to the compile command line.
|0.11 -- Configuring your compiler: Warning and error levels |
|0.9 -- Configuring your compiler: Build configurations |