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

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

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

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

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

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

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

'operator': unsigned/negative constant mismatch

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

'operator': expression is always false

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

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

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

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

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

'function': unreferenced inline function has been removed

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

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

function call before comma missing argument list

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

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

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

expression has no effect; expected expression with side-effect

'__assume' contains effect 'effect'

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

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

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

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

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

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

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

XML document comment has an ambiguous cross reference

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

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

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

'function': function not inlined

function 'function' selected for inline expansion

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

'bytes' bytes padding added after construct 'member_name'

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

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

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

wide string literal cast to 'LPSTR'

string literal cast to 'LPWSTR'

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

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

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

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

Change History

Date

History

Reason

July 2009

Added levels and messages to warnings

Customer feedback.