[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: Dict parsing question
From:       Lawrence D'Oliveiro <ldo () geek-central ! gen ! nz>
Date:       2024-01-02 21:28:03
Message-ID: 20240103102803.03649f4c () theon ! geek-central ! gen ! nz
[Download RAW message or body]

On Tue, 2 Jan 2024 11:47:30 +0000, Simon McVittie wrote:

> This is not just dicts: the elements of an array of (u)int64 or double
> have the same property that the 8-byte alignment of each element is
> greater than the 4-byte alignment of the first byte of the array
> length. This just means that you might need padding between the
> array length and the actual content (the first element).

But you don't know on what boundary the array length is positioned: if
it's already at an address that is a multiple of 8 bytes (which could
happen, say, 50% of the time), then the addition of 4 bytes of padding
means the element field is no longer 8-byte-aligned.

This is why, in order to have 8-byte alignment for the elements of a
structure, you have to guarantee at least 8-byte alignment for the
structure itself.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic