Re: Dumb question about GTK--

Tero Pulkkinen <> writes:

> Hmm, this is odd, why isnt gtk's set_events using GdkEventMask structure
> in set_events() argument instead of the current integer?? It would
> make this typesafe, unlike what it is currently... (maybe that should
> be fixed?) Using the enum would let people know from the interface how
> to use it - currently its kinda odd...
> I think one thing that should be done is to check all integer arguments
> in gtk and check that there isnt anything that could be enums or other
> more restricted types! Integers in public interface where they dont
> represent integer value are really bad..
> or then, maybe there's something I've missed :)

I think you have. In C using enumerations for mask fields is fine (and
I prefer it that way because it shows in the header what type:
needed). But AFAIK, in C++,


would be invalid if the argument was of type GdkEventMask. 

[ That is, in C++, a enumeration variable can only be assigned one of
  the values of the enumeration. ]

(But you're the C++ expert) So I think that's why guint's are used for
mask fields in many places. (Though it isn't consistent right now)


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