Re: GObject: Freeing memory of instance members?



On Sat, May 05, 2007 at 05:45:06PM +0200, ??ystein Johansen wrote:
> 
> Hello?! Wait a minute.... The macro (G_DEFINE_TYPE) prototypes the
> instance init function to:
> 
> static void my_thing_init( MyThing *self);
> 
> (line 358 in my gtype.h)
> 
> however API reference for GInstanceInitFunc() saysthe arguments should be:
> (GTypeInstance *instance, gpointer g_class);

Yes, but almost no-one actually uses the second argument.
And since unused trailing arguments can be safely ignored in
C, commonly they are not even declared.

If you really need the second argument (for instance when
a parent class performs some common initialization based on
subclass-specified information and therefore it needs to
know the actual type being initialized) you cannot use these
macros.

Yeti

--
http://gwyddion.net/



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