sizeof a struc field
Doug Gwyn
gwyn at smoke.BRL.MIL
Thu Oct 12 11:51:08 AEST 1989
In article <7678 at cdis-1.uucp> tanner at cdis-1.uucp (Dr. T. Andrews) writes:
-In article <11227 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
-)) ... WHY (((type *)0)->anything) is disallowed in the context
-)) of compile-time expressions.
-) Because (type *)0 is SYNTACTICALLY a null pointer, and there is a
-) prohibition against using a null pointer as the left operand of ->.
-It is begging the question to say that "it is disallowed because it
-is prohibited". The sizeof() operator is used to extract type
-information, and the cited NULL pointer happens to come complete
-with all of the required type information.
No, there IS no type information, because the construct is
officially meaningless. You THINK you know what type was MEANT,
but the compiler is not obliged to mimic your thought processes.
This is not an issue about sizeof, but rather about ->.
More information about the Comp.lang.c
mailing list