Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!flaps From: flaps@utcs.UUCP Newsgroups: net.lang.c Subject: Re: Yet another ALIGN idea. (some discussion) Message-ID: <1986Jul9.021022.12329@utcs.uucp> Date: Wed, 9-Jul-86 02:10:22 EDT Article-I.D.: utcs.1986Jul9.021022.12329 Posted: Wed Jul 9 02:10:22 1986 Date-Received: Wed, 9-Jul-86 02:41:15 EDT References: <1986Jun29.15:39:38.4762@utcs.uucp> <1038@ttrdc.UUCP> Reply-To: flaps@utcs.UUCP (Alan J Rosenthal) Organization: University of Toronto Lines: 30 In article <1038@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: >Say if ajr's suggestion were implemented and /usr/include/align.h contained >something like > >#define ALIGNSIZE 4 /* long int */ > >Now, given an arbitrary char* pointer, how do we tell if it is aligned? [provides the simple case] >But... what about a machine where alignments are "screwy," for example they >wanted doubles to be located at some fixed offset, say 2, from addresses which >are integral multiples of 4 or 8? #define OFFSET 2 #define ISALIGNED(p)((p)%4 == 2) or of course in the usual case: #define ALIGNSIZE 4 #define OFFSET 0 #define ISALIGNED(p)((p)%4 == 0) Of course this could be expanded for any other information that a user needed to know about the alignment. And since it would all be in an include file, it would not break any existing programs, and is not truly an addition to the language. I think it would be good to put it in the standard. ajr