Keith Packard wrote: > > Around 23 o'clock on Jan 11, Thiemo Seufer wrote: > > > Exactly. xlib seems to use the sum of the size of the primitives in an > > element instead of the size of the first element. > > 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.
Correct, ANSI C tightened the rules a bit, mostly in order to make C more portable. > 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? I would think so. I have, however, no detailed knowledge about the ARM ABIs. Thiemo
signature.asc
Description: Digital signature