编译器警告(等级 3)C4316

在堆上分配的对象可能不会为此类型对齐。

通过使用 operator new 分配的过度对齐的对象可能没有指定的对齐方式。 为过度对齐类型重写 operator newoperator 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
}