Strongly Specify Alignment for FFI Allocation

Manuel M T Chakravarty chak at
Thu Sep 24 22:08:21 EDT 2009

Thomas DuBuisson:
> Aside from section 5.7 (storable) and comments on 'alignPtr', the only
> mention of alignment in the FFI addendum is on
> mallocBytes/allocaBytes:
> "The block of memory is sufficiently aligned for any of the basic
> foreign types (see Section 3.2) that fits into a memory block of the
> allocated size"
> It would be beneficial if this wording was applied to all allocation
> routines - such as mallocForeignPtrBytes, mallocForeignPtrArray, etc.
> For the curious, this proposal was born from the real-world issue of
> pulling Word32's from a ByteString in an efficient but portable manner
> (binary is portable but inefficient, a straight forward
> unsafePerformIO/peek is efficient but need alignment).

I agree that we should be more precise here.

> If no glaring issue comes up then I'll formalize / make a ticket,

Can you please summarise the exact additions that you would like to  
see as a follow-up email?  I will collect all changes that we want to  
make to the existing FFI Addendum before it goes into the 2009 issue  
of Haskell'.


More information about the Haskell-prime mailing list