I assume that the C_ASSERT macro is defined as follows:
#define C_ASSERT(x) typedef char C_ASSERT_ ## __COUNTER__ [(x) ? 1 : -1];
This is a compilation time statement: if the compilation time expression x true, then it expands to about
typedef char C_ASSERT_1[1];
which declares a type name C_ASSERT_1 as an alias for type char[1] (an array of 1 char ). Converely, if the expression x false, it expands to
typedef char C_ASSERT_1[-1];
which is a compiler error, since you cannot have a type of negative array size.
Therefore, your problem is that the expression sizeof(somestruct) == some#define is false, i.e. the size of somestruct NOT what your code expects. You need to fix this - either resize somestruct or change the value of some#define , making sure that it doesn't break anything.
source share