CL /w4

Syntax

/w4number

The required argument consists of whatever follows immediately within the same command-line token, else is the whole of the next command-line token if this token does not begin with a hyphen or forward slash.

The argument is formally numeric. Values outside the range 4001 to 4999 inclusive are coerced to 4999, with a warning (D4014).

Relations

The /w4 option has no syntactical relations with other options.

This option passes to the front-end C and C++ compilers (C1 and C1XX) only.

Behaviour

The /w4 option directs that the specified warning number always be requested at level 4, no matter what the circumstances of the warning’s occurrence.

This option is ineffective for warning C4200. All C and C++ source files, even if empty, are compiled with a forced inclusion at the very start. This “file” of predefined types is hard-coded into the compiler. Some of these types have unsized arrays as members. Each instance is preceded by #pragma warning (disable : 4200) and followed by #pragma warning (default : 4200). This is arguably pointless, since the compiler disables warnings and errors (though not fatal errors) while processing this built-in inclusion, but a side-effect is that when the compiler progresses to the user-supplied source code, warning C4200 has already been set to its default behaviour. Whatever may have been intended by giving 4200 as the argument to a /w1, /w2, /w3, /w4, /wd, /we or /wo option on the command line is then irrelevant, essentially as if #pragma warning (default : 4200) had been the first line of the source file.