I tried to use BUILD_BUG_ON_ZERO in a simple user space application and it is failed to compile
#include <stdio.h>
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
int main()
{
int i;
BUILD_BUG_ON_ZERO(i);
return 0;
}
error: bit-field ‘<anonymous>’ width not an integer constant
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
Can anyone please provide me hints on the error.