[...]
> I have another question: why GInstanceInitFunc is needed
> since the constructor can do the same thing? Is it possible to not
> override the parent's constructor just add new codes in the GInstanceInitFunc?
Yes; Usualy (or I guess I should say "historicly") people use the GInstanceInitFunc in the GTypeInfo struct to initialize new instances and omit assigning a constructor method to the GObjectClass at all;
If I'm not mistaken, people can use the "constructor" to have an entry point in the instantiation where all construct properties are already assigned.
> About the g_newa and g_new0, from the source I think g_newa just call > system malloc while g_new0 call g_malloc0 that will ensure safe > pointor operation using one pointor table. Am I right?
See: http://developer.gnome.org/doc/API/2.0/glib/glib-Memory-Allocation.html#id3061089 And: http://developer.gnome.org/doc/API/2.0/glib/glib-Memory-Allocation.html#g-alloca
They basicly wrap alloca; which is used to dynamicly allocate *stack* space; memory allocated with g_newa() should only be used in the current stack frame and should never be explicitly freed.
Cheers, -Tristan
_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list