Jan. 18, 2024
5:59 a.m.
On Wed Jan 17 22:57:55 2024 +0000, Rémi Bernon wrote:
For flexible array members and to avoid some possible undefined behavior due to struct alignment I usually also add something like that: ``` C_ASSERT(sizeof(struct pool) == offsetof(struct pool, cues[0])); ``` (And if it breaks because of alignment, layout the struct differently or add some explicit padding, but it's rarely needed). IIRC this is guaranteed by C standard to never fail? Do you have an example where alignment breaks things?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4852#note_57893