Freigeben über


Compiler Warnings That Are Off by Default

The compiler includes warnings that are turned off by default because most users don't want to see them. However, you can enable these warnings 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'

C4311 (level 1)

'variable' : pointer truncation from 'type' to 'type'

C4312 (level 1)

'operation' : conversion from 'type1' to 'type2' of greater size

C4339 (level 4)

'type' : use of undefined type detected in CLR meta-data - use of this type may lead to a runtime exception

C4342 (level 1)

behavior change: 'function' called, but a member operator was called in previous versions

C4350 (level 1)

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

C4355

'this' : used in base member initializer list

C4365 (level 4)

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

C4370 (level 3)

layout of class has changed from a previous version of the compiler due to better packing

C4371 (level 3)

layout of class may have changed from a previous version of the compiler due to better packing of member 'member'

C4388 (level 4)

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

C4435 (level 4)

'class1' : Object layout under /vd2 will change due to virtual base 'class2'

C4437 (level 4)

dynamic_cast from virtual base 'class1' to 'class2' could fail in some contexts

C4444 (level 3)

top level '__unaligned' is not implemented in this context

C4471 (level 4)

a forward declaration of an unscoped enumeration must have an underlying type (int assumed)

C4472 (level 1)

'identifier' is a native enum: add an access specifier (private/public) to declare a managed enum

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

C4574 (level 4)

'identifier' is defined to be '0': did you mean to use '#if identifier'?

C4608 (level 3)

'symbol1' has already been initialized by another union member in the initializer list, 'symbol2'

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

C4668 (level 4)

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

C4682 (level 4)

'symbol' : no directional parameter attribute specified, defaulting to [in]

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

C4738 (level 3)

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

C4767 (level 4)

section name 'symbol' is longer than 8 characters and will be truncated by the linker

C4786 (level 3)

'symbol' : object name was truncated to 'number' characters in the debug information

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

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

C4986 (level 4)

'symbol': exception specification does not match previous declaration

C4987 (level 4)

nonstandard extension used: 'throw (...)'

C4988 (level 4)

'symbol': variable declared outside class/function scope

See Also

Reference

warning