[Xcb] RFC: Altenum updates for xcb/proto

Peter Harris pharris at opentext.com
Wed Feb 25 13:13:14 PST 2009

Barton C Massey wrote:
> In message <49A5A073.4090209 at opentext.com> you wrote:
>> We could rename xcb_<enumname>_t to xcb_<enumname>_enum or
>> similar, but that would break any existing code that
>> actually uses the enum types for anything (not that I'm
>> aware of any). Or, if we're mucking with enum_t
>> definitions, we could just toss them altogether and
>> #define the constants (since C chucks enum members into
>> the global namespace anyway).
> That'd be my vote.  It's only C. :-)


Aside from breaking the API, I worry about namespace collisions in non-C
languages too.

To be perfectly honest, it doesn't hurt me. Lua doesn't have types (at
least, not the way C does), so there isn't any XID typedef equivalent. I
imagine Perl would be similar.

Java _does_ have types, but my work in Java passes XIDs around as an
unsigned int for performance reasons - Java's equivalent of a typedef is
the extension of a class, and boxing up all the XIDs gets heavy. Now
that I think of it, Lua or Perl could use objects to represent XIDs too,
if you really wanted to inflict pain on yourself...

I haven't looked at the Python or Haskell bindings.

Maybe this is all in my head. Is C the only current language with a
lightweight typedef? (Does Ada count?)

>> Alternatively, we could use a different name for the enum.
> Uggh.


>> Unique names for non-zero None are a given, of course.
>> XCB_NOTIFY_DETAIL_NONE == 7, to pick the example from xproto.
>> XCB_RENDER_SUB_PIXEL_NONE == 5, to pick the extension example. I don't
>> think either of those conflict with the global XCB_NONE.
> Since some of these need additional naming, I'd like to see
> all of them done that way, so that I don't have to know
> whether my particular NONE is 0 to guess what its name is.

Fair enough.

Peter Harris
               Open Text Connectivity Solutions Group
Peter Harris                    http://www.opentext.com/connectivity
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866

More information about the Xcb mailing list