sizeof a struc field

Richard O'Keefe ok at cs.mu.oz.au
Sat Oct 21 20:04:28 AEST 1989


In article <7685 at cdis-1.uucp>, tanner at cdis-1.uucp (Dr. T. Andrews) writes:
> What we have not heard is a convincing explanation of why the cited
> construct should be considered harmful.  No excuse for an
> implementation that might blow up on it has been given.  Further,
> no useful alternative has (to date) shown up.

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.



More information about the Comp.lang.c mailing list