K
Kaz Kylheku
[email protected] wrote:
(snip)
Yes if you sizeof(type) someone could change the type, such that
it didn't match.
But one could also change the name such that it didn't match.
In the expression sizeof(X) or sizeof X, the compiler doesn't verify
that X agrees with anything in the surrounding code semantically;
the sizeof expression stands completely alone.
Now in sizeof(X), where X is an identifier, X could contain a typo such
that it happens to match a declared identifier. Since the parentheses are
present, this wrong X can be a typedef name or an object.
If X has a typo in sizeof X, X can only be an object, not a type; there is a
smaller "typo target space". There are usually fewer declared objects than
there are declared type names and objects.
If sizeof *X has a typo in identifier X, the typo has to land on an
identifier which is declared such that it takes a unary * operator.
There are usually fewer declared pointers than there are declared objects.