Re^3: offsets in structures.

Duk Bekema duk at klipper.UUCP
Thu Oct 25 19:20:52 AEST 1984


In article <3252 at rabbit.UUCP> mjs at rabbit.UUCP (M. J. Shannon, Jr.) writes:
>How about this fragment for a `portable' method of computing structure
>offsets:
>
>	f(sp)
>	struct stuff *sp;
>	{
>		int	offset; /* may need to be long for some */
>
>		offset = (char *) &sp->member - (char *) sp;
>	}

Wouldn't you want to return it? :-)

				Duk Bekema
				...!{seismo|decvax|philabs}!mcvax!vu44!duk



More information about the Comp.lang.c mailing list