Re: Why keysym constants in gdk/gdkkeysyms.h are defined as macros, not as an enum?



On 06/26/2012 05:31 PM, Bastien Nocera wrote:
If we used enums, we would restrict the keysyms to the declared values.

Well, C doesn't actually have such restriction. From the user's point of view, enums and macros are equivalent. Both of them work as aliases to an int value, the only difference is that macros are replaced by the preprocessor and and enums - by the compiler.

It's possible for keysyms not to have a constant declared in GDK, for
example when a new keysym has been added to X.org but GDK hasn't been
updated yet.

User could simply use the X.org macros until equivalent keysyms become available in GDK.

So using enums instead of constants is detrimental to
applications and GTK+ not breaking when keysyms get added.

It's impossible for an application to break when enum values are added. They end up as integers within the code anyway and unless their values change, API/ABI stays the same.

Cheers,

Mark


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]