Freigeben über


VC extensions list

MSDN has a page describing various VC extensions. But it is far from complete. 

I've collected a list of nonstandard extensions provided by VC, some of them are evil. If you want to write standard conformant C++ code, you'd better be aware of these extensions which are on by default. Some commonly (mis-)used extensions are in bold.

W4001: nonstandard extension 'single line comment' was used
W4152: nonstandard extension, function/data pointer conversion in expression
W4200: nonstandard extension used : zero-sized array in struct/union
W4201: nonstandard extension used : nameless struct/union
W4202: nonstandard extension used : '...': prototype parameter in name list illegal
W4203: nonstandard extension used : union with static member variable
W4204: nonstandard extension used : non-constant aggregate initializer
W4205: nonstandard extension used : static function declaration in function scope
W4206: nonstandard extension used : translation unit is empty
W4207: nonstandard extension used : extended initializer form
W4208: nonstandard extension used : delete [exp] - exp evaluated but ignored
W4210: nonstandard extension used : function given file scope
W4211: nonstandard extension used : redefined extern to static
W4212: nonstandard extension used : function declaration used ellipsis
W4213: nonstandard extension used : cast on l-value
W4214: nonstandard extension used : bit field types other than int
W4215: nonstandard extension used : long float
W4216: nonstandard extension used : float long
W4218: nonstandard extension used : must specify at least a storage class or a type
W4221: nonstandard extension used : 'identifier' : cannot be initialized using address of automatic variable
W4223: nonstandard extension used : non-lvalue array converted to pointer
W4224: nonstandard extension used : formal parameter 'identifier' was previously defined as a type
W4226: nonstandard extension used : 'keyword' is an obsolete keyword
W4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
W4231: nonstandard extension used : 'identifier' before template explicit instantiation
W4232: nonstandard extension used : 'identifier' : address of dllimport 'dllimport' is not static, identity not guaranteed
W4233: nonstandard extension used : 'keyword' keyword only supported in C++, not C
W4234: nonstandard extension used : 'keyword' keyword reserved for future use
W4235: nonstandard extension used : 'keyword' keyword not supported on this architecture
W4238: nonstandard extension used : class rvalue used as lvalue
W4239: nonstandard extension used : 'token' : conversion from 'type' to 'type'
W4240: nonstandard extension used : access to 'classname' now defined to be 'access specifier', previously it was defined to be 'access specifier'
W4288: nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope
W4289: nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
W4353: nonstandard extension used: constant 0 as function expression.  Use '__noop' function intrinsic instead
W4480: nonstandard extension used: specifying underlying type for enum 'enum'
W4481: nonstandard extension used: override specifier 'keyword'
W4482: nonstandard extension used: enum 'enum' used in qualified name
W4509: nonstandard extension used: 'function' uses SEH and 'object' has destructor
W4836: nonstandard extension used : 'type' : local types or unnamed types cannot be used as template arguments

C2599: 'enum' : forward declaration of enum type is not allowed

Comments

  • Anonymous
    December 11, 2008
    > Here is a list of nonstandard extensions provided by VC, some of them are evil. If you want to write standard conformant C++ code, you'd better be aware of these extensions which are on by default. Well, or use /Za :)

  • Anonymous
    December 11, 2008
    Unfortunately, if you turn on /Za, you can no longer build windows application because there will be tons of errors in windows.h :P As far as I know, /Za is originally designed to get C compiler conformant to ANSI C. And it doesn't support ANSI C++ very well.