How to use _Static_assert to check if char is 1 byte in compile time in C

1 Answer

0 votes
#define STATIC_ASSERT _Static_assert

STATIC_ASSERT(sizeof(char) == 1, "Expecting char to be 1 bytes");

int main(void) {


}




/*
compile:

0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

*/

 



answered Apr 28, 2022 by avibootz
...