Storable laws
Henning Thielemann
lemming at henning-thielemann.de
Sat Dec 16 15:45:59 UTC 2017
On Sat, 16 Dec 2017, Sven Panne wrote:
> 2017-12-16 15:16 GMT+01:00 Henning Thielemann <lemming at henning-thielemann.de>:
> I thought that arrays require alignment of their elements.
>
>
> Yes, and if you start aligned, the pokeElemOff law keeps you aligned. If you don't start aligned, Storable never
> magically aligns the first element, anyway, so this must have been intentional (e.g. an array within packed
> data).
>
> In theory one could have an e.g. 7-byte data type with 8-byte alignment requirements, but I think we can re-open
> the discussion when a processor manufacturer is masochistic enough to do that. ;-)
I more think of a custom struct with size 12 bytes consisting of a 64 bit
and 32 bit word. It must be 8-byte aligned. You would have to align all
elements at multiples of 8-byte and the address difference between two
array elements is 16 not 12.
On x86 Linux there would be no problem because a 12 byte struct containing
a 64 bit word must already be padded to 16 byte. But that's an ABI
definition and Storable wants to keep independent from that, right?
More information about the Libraries
mailing list