Udostępnij za pośrednictwem


Compiler Warnings That Are Off by Default

The compiler includes warnings that are turned off by default. If a warning is turned off by default, most users would not want to see it. However, you can enable such a warning 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).

  • /Wall
    /Wall enables all warnings that are off by default.

The following warnings are turned off by default.

C4061 (level 4)

enumerator 'identifier' in a switch of enum 'enumeration' is not explicitly handled by a case label

C4062 (level 3)

enumerator 'identifier' in a switch of enum 'enumeration' is not handled

C4191 (level 3)

'operator/operation': unsafe conversion from 'type of expression' to 'type required'

C4242 (level 4)

'identifier': conversion from 'type1' to 'type2', possible loss of data

C4254 (level 4)

'operator': conversion from 'type1' to 'type2', possible loss of data

C4255 (level 4)

'function': no function prototype given: converting '()' to '(void)'

C4263 (level 4)

'function': member function does not override any base class virtual member function

C4264 (level 1)

'virtual_function': no override available for virtual member function from base 'class'; function is hidden

C4265 (level 3)

'class': class has virtual functions, but destructor is not virtual

C4266 (level 4)

'function': no override available for virtual member function from base 'type'; function is hidden

C4287 (level 3)

'operator': unsigned/negative constant mismatch

C4289 (level 4)

nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope

C4296 (level 4)

'operator': expression is always false

C4302 (level 2)

'conversion': truncation from 'type1' to 'type2'

C4350 (level 1)

behavior change: 'member1' called instead of 'member2'

C4365 (level 4)

'action': conversion from 'type_1' to 'type_2', signed/unsigned mismatch

C4412 (level 2)

'function': function signature contains type 'type'; C++ objects are unsafe to pass between pure code and mixed or native

C4431 (level 4)

missing type specifier - int assumed. Note: C no longer supports default-int

C4514 (level 4)

'function': unreferenced inline function has been removed

C4536 (level 4)

'type name': type-name exceeds meta-data limit of 'limit' characters

C4545 (level 1)

expression before comma evaluates to a function which is missing an argument list

C4546 (level 1)

function call before comma missing argument list

C4547 (level 1)

'operator': operator before comma has no effect; expected operator with side-effect

C4548 (level 1)

expression before comma has no effect; expected expression with side-effect

C4549 (level 1)

'operator': operator before comma has no effect; did you intend 'operator'?

C4555 (level 1)

expression has no effect; expected expression with side-effect

C4557 (level 3)

'__assume' contains effect 'effect'

C4571 (level 4)

informational: catch(…) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught

C4619 (level 3)

#pragma warning: there is no warning number 'number'

C4623 (level 4)

'derived class': default constructor could not be generated because a base class default constructor is inaccessible

C4625 (level 4)

'derived class': copy constructor could not be generated because a base class copy constructor is inaccessible

C4626 (level 4)

'derived class': assignment operator could not be generated because a base class assignment operator is inaccessible

C4628 (level 1)

digraphs not supported with -Ze. Character sequence 'digraph' not interpreted as alternate token for 'char'

C4640 (level 3)

'instance': construction of local static object is not thread-safe

C4641 (level 3)

XML document comment has an ambiguous cross reference

C4668 (level 4)

'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'

C4686 (level 3)

'user-defined type': possible change in behavior, change in UDT return calling convention

C4692 (level 1)

'function': signature of non-private member contains assembly private native type 'native_type'

C4710 (level 4)

'function': function not inlined

C4711 (level 1)

function 'function' selected for inline expansion

C4738 (level 3)

storing 32-bit float result in memory, possible loss of performance

C4820 (level 4)

'bytes' bytes padding added after construct 'member_name'

C4826 (level 2)

conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior

C4836 (level 1)

nonstandard extension used : 'type' : local types or unnamed types cannot be used as template arguments

C4837 (level 4)

trigraph detected: '??%c' replaced by '%c'

C4905 (level 1)

wide string literal cast to 'LPSTR'

C4906 (level 1)

string literal cast to 'LPWSTR'

C4917 (level 1)

'declarator': a GUID can only be associated with a class, interface, or namespace

C4928 (level 1)

illegal copy-initialization; more than one user-defined conversion has been implicitly applied

C4931 (level 4)

we are assuming the type library was built for number-bit pointers

C4946 (level 1)

reinterpret_cast used between related classes: 'class1' and 'class2'

C4962

'function': profile-guided optimizations disabled because optimizations caused profile data to become inconsistent

See Also

Reference

warning