[Xcb] Add sizeof tag to struct
Daniel Martin
consume.noise at gmail.com
Mon Jan 7 12:23:50 PST 2013
On Sun, Dec 23, 2012 at 03:29:22PM +0100, Daniel Martin wrote:
> Hi,
>
> this is yet another proposal. It adds an additional sizeof tag to
> structs, which simplifies size calculations for structs with a variadic
> size if they provide a length field which references to the struct
> itself.
> In theory it could be used to work around alignment issues (see #23403),
> but imho it shouldn't and the description states so.
Dismissed! As discussed on IRC this sizeof element is a bad idea which
doesn't solve anything and works around a problem which can and should
be fixed in another way.
> It's usefull for various structs which can be found in XI1 and XI2.
> Those structs have a common header (type/class and length field), where
> the length field already gives the size of the whole struct including
> lists attached to the struct, i.e.:
> - INPUTINFO http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XIproto.txt#n320
> - CLASS http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XI2proto.txt#n762
> - HIERARCHYINFO http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XI2proto.txt#n1169
It's very simply to add a list of unintepreted bytes at the end of those
structs. With that given, lists of such structs would work out of the
box - without adding a new element. It doesn't solve the problem either,
but it's a "good" temporary solution.
The actual problem is that we need a switch for those structs. Either in
a struct or nested in a list.
Cheers,
Daniel Martin
More information about the Xcb
mailing list