Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 3) C4341
Collapse the table of content
Expand the table of content

Compiler Warning (level 3) C4341

Error Message

'value' : signed value is out of range for enum constant

An enumerated constant exceeds the limit for an int. The value of the invalid constant is undefined. Constants must resolve to integers between –4,294,967,295 and +4,294,967,295 (signed).

Note that this is a level 3 warning under /Ze and a level 1 warning under /Za.

Example

The following sample generates C4341:

// C4341.cpp
// compile with: /WX /W3 /c
enum ELEMENTS {
   Hydrogen = 1,
   Helium,
   Lithium,
   Beryllium,
   Impossibillium = 4294967296   // C4341
   // try the following line instead
   // Impossibillium = 4294967295
};

The following sample shows that C4341 is a level 1 warning under /Za

// C4341b.cpp
// compile with: /W1 /LD /Za
enum ELEMENTS
{
   Hydrogen = 1,
   Helium,
   Lithium,
   Beryllium,
   Impossibillium = 4294967296  // C4341
   // try the following line instead
   // Impossibillium = 4294967295
};

Community Additions

ADD
Show:
© 2015 Microsoft