sizeof a struc field

Keith Gabryelski ag at cbmvax.UUCP
Mon Oct 23 12:12:47 AEST 1989


I didn't see this come up anywhere...

>	sizeof(((type *)0)->member)		/* cited construct */

Is there a problem with declaring the structure pointer as an extern
and then doing the sizeof thang?  As:

	extern struct foo *Foo;

	sizeof Foo->member

This requires no data allocation which was the original gripe, eh?

Pax, Keith

Ps, This casting NULL to some structure pointer then grabbing a member
from it FOR ANY REASON seems dubious, at best, to me.  $.02.
-- 
 "It took no computation to dance to the rock 'n roll station" -- VU
  ag at cbmvax.commodore.com     Keith M. Gabryelski      ...!uunet!cbmvax!ag



More information about the Comp.lang.c mailing list