Loading AI tools
来自维基百科,自由的百科全书
stdalign.h
是C語言標準2011版新增加的C標準函數庫頭文件,為向後兼容目的定義了4個宏:
在C++11中,alignas與alignof是關鍵字。alignas用於變量定義、數據成員聲明、class\struct\union的聲明與定義。alignas不可用於基本類型的別名、數組類型等。alignas只能用於更嚴格(更大對齊值)。alignas的參數可以為數、類型。
alignof的參數為類型。
#include <stdalign.h>
char alignas(double) buf[30];
char alignas(32) foo[7];
typedef struct { int a; double b; } S;
// alignof(S) == 8 为真
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.