In this article

Compiler warnings that are off by default

In this article

The compiler includes warnings that are turned off by default, because most developers don't want to see them. In some cases, they represent a stylistic choice, or are common idioms in older code, or take advantage of a Microsoft extension to the language. In other cases, they indicate an area where programmers often make incorrect assumptions, which may lead to unexpected or undefined behavior. Some of these warnings may be very noisy in library headers. The C runtime libraries and the C++ standard libraries are intended to emit no warnings only at warning level /W4.

Enable warnings that are off by default

You can enable warnings that are normally off by default by using one of the following options:

#pragma warning(default :warning_number)

The specified warning (warning_number) is enabled at its default level. Documentation for the warning contains the default level of the warning.

#pragma warning(warning_level:warning_number)

The specified warning (warning_number) is enabled at the specified level (warning_level).

14.1 This warning is available starting in Visual Studio 2015 Update 1.14.3 This warning is available starting in Visual Studio 2015 Update 3.15.3 This warning is available starting in Visual Studio 2017 version 15.3.15.5 This warning is available starting in Visual Studio 2017 version 15.5.15.7 This warning is available starting in Visual Studio 2017 version 15.7.Perm This warning is off unless the /permissive- compiler option is set.

Warnings off by default in earlier versions

These warnings were off by default in versions of the compiler before Visual Studio 2015: