I encountered the following macro definition when reading the globals.h in the Google V8 project.
// The expression ARRAY_SIZE(a) is a compile-time constant of t
If sizeof(a) / sizeof(*a)
has some remainder (i.e. a
is not an integral number of *a
) then the expression would evaluate to 0
and the compiler would give you a division by zero error at compile time.
I can only assume the author of the macro was burned in the past by something that didn't pass that test.