Home / Compile-time asserts in C edit
Try Documentalist, my app that offers fast, offline access to 190+ programmer API docs.

Asserts are good. Compile-time asserts are even better. Here’s how to define and use them in C.
#ifndef CASSERT
#define CASSERT( exp, name ) typedef int dummy##name [ (exp ) ? 1 : -1 ];
#endif
CASSERT( sizeof(int16_t) == 2, int16_t_is_two_bytes )

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:

Share on        

Need fast, offline access to 190+ programmer API docs? Try my app Documentalist for Windows