Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!decvax!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Determing alignment of (char *) pointer Message-ID: <189@haddock.UUCP> Date: Tue, 9-Dec-86 22:43:30 EST Article-I.D.: haddock.189 Posted: Tue Dec 9 22:43:30 1986 Date-Received: Wed, 10-Dec-86 10:57:58 EST References: <1510@mit-trillian.MIT.EDU> Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 11 Summary: All of the above In article <1510@mit-trillian.MIT.EDU> newman@athena.mit.edu (Ron Newman) writes: >Which is a better, more portable way of determining whether a pointer >[char *p] is aligned? Several answers have been proposed, each of which fails on some machine. I had this same situation a while back, and I solved it with the "most portable" method: "if (isaligned(p)) ...". I then wrote the isaligned() macro, and put it in a header file with a big comment. Now the code works on any machine, as long as I keep that header file up-to-date. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint