Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!cartan!brahms!desj From: desj@brahms (David desJardins) Newsgroups: comp.lang.c Subject: Re: Determing alignment of (char *) pointer Message-ID: <487@cartan.Berkeley.EDU> Date: Fri, 5-Dec-86 19:20:13 EST Article-I.D.: cartan.487 Posted: Fri Dec 5 19:20:13 1986 Date-Received: Sat, 6-Dec-86 03:11:34 EST References: <1510@mit-trillian.MIT.EDU> Sender: daemon@cartan.Berkeley.EDU Reply-To: desj@brahms (David desJardins) Organization: Math Dept. UC Berkeley Lines: 16 In article <1510@mit-trillian.MIT.EDU> newman@athena.mit.edu (Ron Newman) writes: > char *p; > > if ((long)p & 3) ... > > if ((long)(p - (char *) 0) & 3) ... Why not use if (p != (char *) (long *) p) ... ? This should give you the relevant information (can a long be stored at the location pointed to by p?) without any machine dependencies. I suppose on some (broken) compilers it might not work... -- David desJardins