Re: why do constructors return GtkWidget?



I'm also using the real types in my declarations, though I'm paying the price with casts.

And here I mean:


GtkMenuItem *dir_or_not = GTK_MENU_ITEM (gtk_menu_item_new_with_label ("Or not"));
    gtk_menu_shell_append (GTK_MENU_SHELL (directory_filter_menu),
            GTK_WIDGET (dir_or_not));

The price I'm paying here is GTK_MENU_ITEM and GTK_WIDGET. Which would both go away with another convention.

As I said, I believe if the convention was changed to return the real types most of the GTK programs would not have an increase in the number of casts (now that GUIs are built with GtkBuilder). But who knows.

I guess this wouldn't even change the ABI (??) it would just cause old code to compile with warnings (except those who build with -Werr ;-) ).

Well in any case let's forget it, I guess it's impossible to change this by now, so this is all just rhetorical. But thanks for the clarifications.

emmanuel





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