編譯器警告 (層級 3) C4316
在堆積上配置的物件可能無法對齊此類型。
使用 operator new
所配置的過度對齊物件可能沒有指定的對齊方式。 覆寫 過度對齊類型的運算符 new 和 operator delete ,讓它們使用對齊的配置例程, 例如_aligned_malloc 和 _aligned_free。 下列範例會產生 C4316:
// C4316.cpp
// Test: cl /W3 /c C4316.cpp
__declspec(align(32)) struct S {}; // C4324
int main() {
new S; // C4316
}