Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mmintl.UUCP Path: utzoo!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.unix,net.lang.c Subject: Re: Portablity using structures and malloc - Help Message-ID: <548@mmintl.UUCP> Date: Mon, 29-Jul-85 16:21:56 EDT Article-I.D.: mmintl.548 Posted: Mon Jul 29 16:21:56 1985 Date-Received: Wed, 31-Jul-85 22:38:53 EDT References: <81@drux1.UUCP> <907@umcp-cs.UUCP> <4772@allegra.UUCP> <257@bocklin.UUCP> <5181@elsie.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 12 Xref: linus net.unix:4581 net.lang.c:5295 Summary: Better alignment option In article <5181@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes: >In article <257@bocklin.UUCP>, wendt@bocklin.UUCP writes: >> An easy way to determine alignment requirements is to take the size >> of a structure containing one character. Odd-length structures are >> invariably rounded up to convenient units by the compiler. > >Or, preferably, > #define ALIGNMENT (sizeof (struct { char :1;})) >which avoids having to make up a name for a structure element. This also has the advantage of working properly on a hypothetical machine where alignment on a character boundary is not required.