any policy for foo_new() return types?



Hello,

First off, I've been so rude to post to this list while not being on it.
Please CC me, thanks.

I have used GNOME and GTK+ for a long time, but only in the past few
days I really got past the "Hello, World" stage. I couldn't help
noticing that every foo_new() method had its own policy for what kind of
struct to return. A few examples (sorry for using GNOME examples):

- gnome_app_bar_new() returns a GtkWidget*
  (its far, but not "oldest" ancestor)
- gnome_mdi_new() returns a GtkObject*
  (its "oldest", and only ancestor)
- gnome_mdi_generic_child_new() returns a GnomeMDIGenericChild
  (an instance of itself)
- gtk_adjustment_new() returns a GtkObject*
  (its "oldest", but not its only ancestor)

I believe that it's common policy to return a GtkWidget* if this is
available in the ancestry, and otherwise fall back to a GtkObject -- but
why this policy, anyway? And why do some of the above examples draw away
from this policy?

Thanks,

Stefan




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