用以下代码,经测试可以实现:
- #define JION(x, y) XJION(x, y)
- #define XJION(x, y) x ## y
- #define static_assert(e) typedef char JION(assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
- void main(void)
- {
- static_assert(sizeof(rst_appparams) == 256);
- //.....
- }
复制代码
结构体不是256的话,会编译错误:
..\System\appparams.c(61): error: #94: the size of an array must be greater than zero
|