static_assert
من cppreference.com
<tbody>
</tbody>
| معرفة في ملف <assert.h>
|
||
#define static_assert _Static_assert |
||
هذا الماكرو اسم آخر لـ _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
}
أنظر أيضا
مقالة مرجع C++ عن Static Assertion
|