Compiler Warning (level 4) C4268
'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.
คำติชม
https://aka.ms/ContentUserFeedback
เร็วๆ นี้: ตลอดปี 2024 เราจะขจัดปัญหา GitHub เพื่อเป็นกลไกคำติชมสำหรับเนื้อหา และแทนที่ด้วยระบบคำติชมใหม่ สำหรับข้อมูลเพิ่มเติม ให้ดู:ส่งและดูข้อคิดเห็นสำหรับ