Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang.c Subject: Re: Yet another ALIGN idea. (some Message-ID: <2600066@ccvaxa> Date: Wed, 9-Jul-86 10:46:00 EDT Article-I.D.: ccvaxa.2600066 Posted: Wed Jul 9 10:46:00 1986 Date-Received: Fri, 11-Jul-86 07:39:21 EDT References: <1038@ttrdc.UUCP> Lines: 19 Nf-ID: #R:ttrdc.UUCP:1038:ccvaxa:2600066:000:886 Nf-From: ccvaxa.UUCP!aglew Jul 9 09:46:00 1986 An alignment constant would not necessarily work, because there are machines that have unusual alignment restrictions. My favorite is `strictly aligned power of two sized' - ie. an object of size N must be aligned on a boundary of 2^ceil(lg(N)), if indexing is to be used to access fields of such an object. Note that malloc(nitems*sizeof(obj)) is conservative for such a beast, assuming sizeof rounds up correctly, but calloc() can be a bit more intelligent. This scheme is strictly size dependent, but screwier schemes are possible. Since an alignment constant doesn't necessarily work, how about an alignmentof(object) operator, analagous to sizeof()? At least that'll work on all architectures that have alignments based on multiples. Andy "Krazy" Glew. Gould CSD-Urbana. USEnet: ihnp4!uiucdcs!ccvaxa!aglew 1101 E. University, Urbana, IL 61801 ARPAnet: aglew@gswd-vms