Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!mcnc!rti-sel!dg_rtp!throopw From: throopw@dg_rtp.UUCP (Wayne Throop) Newsgroups: comp.lang.c Subject: Re: Determing alignment of (char *) pointer Message-ID: <739@dg_rtp.UUCP> Date: Mon, 8-Dec-86 11:11:28 EST Article-I.D.: dg_rtp.739 Posted: Mon Dec 8 11:11:28 1986 Date-Received: Wed, 10-Dec-86 02:47:51 EST References: <1510@mit-trillian.MIT.EDU> <487@cartan.Berkeley.EDU> Lines: 16 > desj@brahms (David desJardins) > 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... Well... no. C casts don't guarantee to alter the alignment of pointers to reflect architectural restrictions. They just DON'T guarantee NOT to do so. Basically, there isn't any portable way of doing this. -- A LISP programmer knows the value of everything, but the cost of nothing. --- Alan J. Perlis -- Wayne Throop !mcnc!rti-sel!dg_rtp!throopw