Geoff Chappell - Software Analyst
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).
The /we option has no syntactical relations with other options.
This option passes to both the front-end and back-end compilers (C1, C1XX and C2).
This option promotes the given warning number to an error. Should the condition associated with the warning occur, it is reported as an error.
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.
Some warning numbers are ordinarily treated as errors, as if the corresponding /we option were generated internally before acting on any options from the command line. For instance, the following table shows the warnings that are promoted automatically by the C++ front-end compiler (C1XX).
|C4226||nonstandard extension used : 'keyword' is an obsolete keyword|
|C4233||nonstandard extension used : 'keyword' keyword only supported in C++, not C|
|C4234||nonstandard extension used : 'keyword' keyword reserved for future use|
|C4235||nonstandard extension used : 'keyword' keyword not supported in this product|
|C4519||default template arguments are only allowed on a class template; ignored|
|C4716||'function' : must return a value|
|C4772||#import referenced a type from a missing type library; 'type' used as a placeholder|