Checking sizeof at compile time [scaryreasoner.wordpress.com]
This article provides explanation of BUILD_BUG_ON macro which is used in linux for example. It can't be used in global scope because it's a statement.
Catching errors early with compile-time assertions [embedded.com]
Dan Saks article which solves the global scope problem with previous one,
#define compile_time_assert(cond, msg) \ typedef char msg[(cond) ? 1 : -1]
Even though message is not shown in some IDEs, at least code line is thus it's easy to decipher it from the msg parameter why it caused an error.