Re: why do constructors return GtkWidget?



On Tue, 2009-09-08 at 13:32 +0200, Emmanuel Touzery wrote:
     It's annoying for me because I find that putting the real types
in 
my code makes it easier to follow (rather than everything being a 
GtkWidget*), but if I go that route, I must constantly up and
downcast...

     From my limited understanding of gobject I would think those 
widgets could return and take the real type and all will work well? am
I 
wrong? or are those historical reasons?

Whatever type is returned, you'll have to do lots of casts, so whatever
convention is used, there's no avoiding that. And returning GtkWidget*
is just the current convention.

I personally would prefer correct types to be used in the API, just to
show exactly what type to expect at runtime. But that's a separate
issue.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




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