Determing alignment of (char *) pointer
Stuart D. Gathman
stuart at bms-at.UUCP
Mon Dec 8 11:25:41 AEST 1986
In article <1510 at mit-trillian.MIT.EDU>, newman at mit-trillian.MIT.EDU (Ron Newman) writes:
> I am using a (char *) pointer to store a sequence of differently-typed
> In particular, I need to determine whether the pointer is 32-bit
> aligned before attempting to store a long by casting it to a (long *).
Cast it to a (long *) and back again then see if it changed.
char *p;
if ( (char *) (long *) p == p) . . .
--
Stuart D. Gathman <..!seismo!dgis!bms-at!stuart>
More information about the Comp.lang.c
mailing list