
int fibs[] = {1, 1, 2, 3, 5};/* Entries may not correspond to actual numbers. Some entries omitted. *//* ... *//* ... *//* ... */
char *err_strings[] = {[] = "Success",[] = "Invalid argument",[] = "Not enough memory",[] = "Bad address",/* ... */[] = "Argument list too long",[] = "Device or resource busy",/* ... */[] = "No child processes"/* ... */};
struct point {int x;int y;int z;}
struct point p = {.x = 3, .y = 4, .z = 5};#define FLAG_LIST(_) \\_(EmittedAtUses) \_(LoopInvariant) \_(Commutative) \_(Movable) \_(Lowered) \_(Guard)
enum Flag {None = 0,FLAG_LIST(DEFINE_FLAG)Total};
enum Flag {None = 0,DEFINE_FLAG(InWorklist)DEFINE_FLAG(EmittedAtUses)DEFINE_FLAG(LoopInvariant)DEFINE_FLAG(Commutative)DEFINE_FLAG(Movable)DEFINE_FLAG(Lowered)DEFINE_FLAG(Guard)Total};
enum Flag {None = 0,InWorklist,EmittedAtUses,LoopInvariant,Commutative,Movable,Lowered,Guard,Total};
bool isreturn hasFlags(1 << flag);\}\void setJS_ASSERT(!hasFlags(1 << flag));\setFlags(1 << flag);\}\void setNotJS_ASSERT(hasFlags(1 << flag));\removeFlags(1 << flag);\}FLAG_LIST(FLAG_ACCESSOR)
/* Force a compilation error if condition is false, but also produce a result* (of value 0 and type size_t), so it can be used e.g. in a structure* initializer (or wherever else comma expressions aren't permitted). *//* Linux calls these BUILD_BUG_ON_ZERO/_NULL, which is rather misleading. */#define STATIC_ZERO_ASSERT(condition) (sizeof(struct { int:-!(condition); }) )#define STATIC_NULL_ASSERT(condition) ((void *)STATIC_ZERO_ASSERT(condition) )/* Force a compilation error if condition is false */#define STATIC_ASSERT(condition) ((void)STATIC_ZERO_ASSERT(condition))
STATIC_ASSERT(Total <= 32)(void)sizeof(struct { int:-!(Total <= 32) })(void)sizeof(struct { int: 0 })(void)sizeof(struct { int: -1 } )
關(guān)注【一起學(xué)嵌入式】,回復(fù)“加群”進(jìn)技術(shù)交流群。
覺得文章不錯(cuò),點(diǎn)擊“分享”、“贊”、“在看” 唄