Keith Packard wrote on 12 Jan 2005 00:03:31 +0100: > No, Xlib assumes that the alignment of the struct or union is the alignment > of the most restrictive element in that struct or union. Before ANSI C > (note, not C99, but the original ANSI C which postdates Xlib), this was the > way C worked. That ANSI C permits more 'flexible' layout is an ABI > incompatible change between K&R and ANSI C.
Couldn't that assumption in the Xlib be removed using the real size of the structure ? > We're talking here about a struct containing two chars. On almost every > machine we've seen, save the ARM, this is two bytes. Would a structure > containing an array of two bytes also be padded to four bytes on this > architecture? Yes, in both cases the resulting structure has a size of 4 bytes. -- Gaëtan LEURENT