Is there anyway to use a
#if sizeof(someThing) != PAGE_SIZE
#error Data structure doesn't match page size
Is there anyway to use a "
sizeof" in a pre-processor macro?
No. The conditional directives take a restricted set of conditional expressions;
sizeof is one of the things not allowed.
Preprocessing directives are evaluated before the source is parsed (at least conceptually), so there aren't any types or variables yet to get their size.
However, there are techniques to getting compile-time assertions in C (for example, see this page).