?
This document uses PHP Chinese website manual Release
在頭文件<assert.h>中定義 | ||
---|---|---|
#define static_assert _Static_assert |
此便利宏擴(kuò)展為關(guān)鍵字_Static_assert。
#include <assert.h>int main(void){ static_assert(2 + 2 == 4, "2+2 isn't 4"); // well-formed static_assert(sizeof(int) < sizeof(char), "this program requires that int is less than char"); // compile-time error}
C11標(biāo)準(zhǔn)(ISO/IEC 9899:2011):
7.2/3診斷<assert.h>(p:186)
| 靜態(tài)聲明的C ++文檔
|:----|