CL /wd

Syntax

/wdnumber

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 /wd option has no syntactical relations with other options.

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

Behaviour

This option disables the given warning number. If the condition associated with the warning occurs, its detection is not reported as a warning.

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 disabled, as if the corresponding /wd option were generated internally before acting on any options from the command line. For instance, the following table shows the warnings that the front-end C++ compiler (C1XX) disables automatically, unless prevented by the /Wall option. A few of these seem to be undocumented and are highlighted yellow.

C4061 enumerate 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
C4062 enumerate 'identifier' in switch of enum 'enumeration' is not handled
C4191 'operator/operation' : unsafe conversion from 'type of expression' to 'type required'
Calling this function through the result pointer may cause your program to fail
C4217 'operator' : member template functions cannot be used for copy-assignment or copy-construction
C4242 'identifier' : conversion from 'type1' to 'type2', possible loss of data
C4254 'operator' : conversion from 'type1':'bits' to 'type2':'bits', possible loss of data
C4255 'function' : no function prototype given: converting '()' to '(void)'
C4263 'function' : member function does not override any base class virtual member function
C4264 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
C4265 'class' : class has virtual functions, but destructor is not virtual
 instances of this class may not be destructed correctly
C4287 'operator' : unsigned/negative constant mismatch
C4289 nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
C4296 'operator' : expression is always value
C4302 'conversion' : truncation from 'type1' to 'type2'
C4339 'type' : use of undefined type detected in CLR meta-data - use of this type may lead to a runtime exception
C4370 '%$pS' : layout of class has changed from a previous version of the compiler due to better packing
C4371 '%$pS' : layout of class may have changed from a previous version of the compiler due to better packing of member '%$S'
C4372 '%$pS' : calling convention for UDT return value has changed from a previous version of the compiler
C4373 '%$S': virtual function overrides '%$pS', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
C4444 '%$I' : top level '__unaligned' is not implemented in this context
C4514 'function' : unreferenced inline function has been removed
C4529 'member_name' : forming a pointer-to-member requires explicit use of the address-of operator ('&') and a qualified name
C4536 'type name' : type-name exceeds meta-data limit of 'limit' characters
C4555 expression has no effect; expected expression with side-effect
C4557 '__assume' contains effect '%$L'
C4619 #pragma warning : there is no warning number 'number'
C4623 'derived class' : default constructor could not be generated because a base class default constructor is inaccessible
C4625 'derived class' : copy constructor could not be generated because a base class copy constructor is inaccessible
C4626 'derived class' : assignment operator could not be generated because a base class assignment operator is inaccessible
C4640 'instance' : construction of local static object is not thread-safe
C4668 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
C4682 'parameter' : no directional parameter attribute specified, defaulting to [in]
C4710 'function' : function not inlined
C4786 'identifer' : identifier was truncated to 'number' characters in the debug/browser information
C4793 native code generated for 'attribute' function 'function'
C4820 'identifier' : 'bytes' bytes padding added after member 'member'
C4905 wide string literal cast to 'type'
C4906 string literal cast to 'type'
C4917 'declarator' : a GUID can only be associated with a class, interface or namespace
C4928 illegal copy-initialization; more than one user-defined conversion has been implicitly applied
C4931 we are assuming the type library was built for number-bit pointers
C4946 reinterpret_cast used between related classes: 'class1' and 'class2'