Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 969 Bytes

compiler-warning-level-3-c4316.md

File metadata and controls

24 lines (19 loc) · 969 Bytes
title description ms.date f1_keywords helpviewer_keywords ms.assetid
Compiler Warning (level 3) C4316
Description of C++ compiler warning C4316
11/04/2016
C4316
C4316
10371f01-aeb8-40ac-a290-59e63efa5ad4

Compiler Warning (level 3) C4316

Object allocated on the heap may not be aligned for this type.

An over-aligned object allocated by using operator new may not have the specified alignment. Override operator new and operator delete for over-aligned types so that they use the aligned allocation routines—for example, _aligned_malloc and _aligned_free. The following sample generates C4316:

// C4316.cpp
// Test: cl /W3 /c C4316.cpp

__declspec(align(32)) struct S {}; // C4324

int main() {
    new S; // C4316
}