structure element offsets

der Mouse mouse at mcgill-vision.UUCP
Sun Dec 21 18:34:24 AEST 1986


In article <7377 at utzoo.UUCP>, henry at utzoo.UUCP (Henry Spencer) writes:
> Or perhaps you were thinking of (type *)(long)x == x ?  That would
> make me nervous but it is technically valid.

Is it?  I seem to remember something in K&R to this effect:

	A pointer may be converted to any integral type large enough to
	hold it.

This does not guarantee that there *is* any integral type large enough
to hold a pointer (any pointer).  On the other hand, they continue

	Whether an int or long is required is machine dependent.

thereby implying that at least one of (int,long) will be sufficient.
But they don't come right out and *say* so, do they?  Do H&S or X3J11
say anything about this?

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse at harvard.harvard.edu



More information about the Comp.lang.c mailing list