[Xcb] Xevent and XCBEvent

Barton C Massey bart at cs.pdx.edu
Mon May 23 21:56:44 PDT 2005


Ah, I see.  I'd forgotten how C is broken, sadly.  Thanks
much for the clarification.

    Bart

In message <1116896492.6929.24.camel at id.minilop.net> you wrote:
> > > So an extra pad field could be produced in that manner by re-emitting
> > > the entire structure inside sizeof.
> > 
> > Why re-emit it rather than just reference it by type or tag?
> > I'm not getting it...
> 
> I know I wasn't particularly clear in describing this suggestion; let me
> re-state it. If there's an alternative option I've missed I think it
> will be easier to see given the sequence of my reasoning.
> 
> We currently have some
> 
>         typedef struct {
>                 CARD8 kind;
>                 CADR8 bar;
>                 CARD16 sequence;
>                 CARD32 baz;
>         } XCBFooEvent;
> 
> The above structure is 8 bytes, and we want to pad it to 32; given
> knowledge of these numbers at code-generation time, we can do the
> subtraction and insert
> 
>                 char pad[24];
> 
> at the end. But we don't currently know those numbers at code-generation
> time. (I think we should, if only so we can generate documentation. But
> I don't think it's a priority right now.) So we could output a temporary
> copy of the structure without padding, then output the real one using
> the first to get the padding right:
> 
>         struct _XCBFooEvent {
>                 CARD8 kind;
>                 CADR8 bar;
>                 CARD16 sequence;
>                 CARD32 baz;
>         };
> 
>         typedef struct {
>                 CARD8 kind;
>                 CADR8 bar;
>                 CARD16 sequence;
>                 CARD32 baz;
>                 char pad[32 - sizeof(struct _XCBFooEvent)];
>         } XCBFooEvent;
> 
> But it's silly to pollute namespaces that way. So the best I can think
> of is describing the structure type inline in the sizeof invocation.
> 
> Am I missing an option?
> 
> --Jamey
> 
> _______________________________________________
> xcb mailing list
> xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the xcb mailing list