Note the use of the word "not".
Note the use of the word "cannot".
Well, sizeof, unless applied to a variable-length array, yields an
integer constant. Which AFAIK, can be used e.g. as array bound. That's
how I understood the OP's "would like, at compile time ideally, [�], to
know the footprint in memory" requirement.
I agree that, when VLAs are not involved, the compiler has sufficient
information to produce the result that he wants; I'm just letting him
know the C standard doesn't mandate support for any feature that would
Note the use of the word "doesn't".
...
Taking both of your remarks into account, I am understanding that
#error with sizeof can produce the output I want at compile time.
I curious how you reached that conclusion, because what I said was
almost precisely the opposite. Well, not exactly - the standard doesn't
mandate support for any features that could be counted on to produce the
result that you want at compile time, but neither does it prohibit them.