use _Static_assert if available

master
leitner 5 years ago
parent 8b0450cd29
commit 50c1daf653

@ -1,4 +1,12 @@
#if __STDC_VERSION__ >= 201112L
#define compiletimeassert(cond) _Static_assert(cond)
#else
#define __X(x, y) x ## y #define __X(x, y) x ## y
#define __Y(x, y) __X(x, y) #define __Y(x, y) __X(x, y)
#define compiletimeassert(cond) struct __Y(foo,__LINE__) { char __temp[1 - (!(cond))*2]; }; #define compiletimeassert(cond) struct __Y(foo,__LINE__) { char __temp[1 - (!(cond))*2]; };
#endif

Loading…
Cancel
Save