alignment

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Jan 11 09:22:40 EST 2003


On 09-Jan-2003, Ross Paterson <ross at soi.city.ac.uk> wrote:
> Two additions I think are required:
> 
> 1) The spec should state that mallocBytes and allocaBytes return a block
>    of memory sufficiently aligned for any of the primitive types supported
>    by the architecture.

I disagree.  These routines should only be required to align the memory
sufficiently for any of the primitive types which could fit in the amount
of space allocated.  For example, double precision floats might occupy
8 bytes, and require 8-byte alignment, but four-bytes allocations should
not be required to be 8-byte aligned.

(This is something the C standard got wrong, IMHO.)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the FFI mailing list