Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 4) C4268

Error Message

'identifier' : 'const' static/global data initialized with compiler generated default constructor fills the object with zeros

A const global or static instance of a non-trivial class is initialized with a compiler-generated default constructor.

Example

// C4268.cpp
// compile with: /c /LD /W4
class X {
public:
   int m_data;
};

const X x1;   // C4268

As this instance of the class is const, the value of m_data cannot be changed.

Community Additions

ADD
Show:
© 2015 Microsoft