Compiler Warning (level 3) C4341

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

This warning is obsolete. It is only generated by Visual Studio 2010 and earlier versions. 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 in Visual Studio 2010 and earlier versions:

// 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
};