sizeof a struc field
Wm E Davidsen Jr
davidsen at crdos1.crd.ge.COM
Wed Oct 25 03:11:50 AEST 1989
In article <2488 at munnari.oz.au>, ok at cs.mu.oz.au (Richard O'Keefe) writes:
| I'm sure I'll be corrected if I'm wrong, but isn't the actual restriction
| that the argument of "sizeof" must be an L-value in ANSI C? If I'm right
| about that, then the problem is not that sizeof ((struct foo*)NULL)->field
| may "blow up", but that ((struct foo*)NULL)->field is not an L-value.
The standard says that you may take the sizeof an array, so the
expression most definitely does not have to be an lvalue. You can also
take sizeof something const.
--
bill davidsen (davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon
More information about the Comp.lang.c
mailing list