mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gobject: Document that classes/objects/interfaces are zero-filled
On initialisation, GObject guarantees to zero-fill class/object/interface structures. Document this so people don’t spend forever writing: my_object->priv->some_member = NULL; my_object->priv->some_other_member = NULL; https://bugzilla.gnome.org/show_bug.cgi?id=729167
This commit is contained in:
@@ -882,10 +882,14 @@ typedef void (*GClassFinalizeFunc) (gpointer g_class,
|
||||
* A callback function used by the type system to initialize a new
|
||||
* instance of a type. This function initializes all instance members and
|
||||
* allocates any resources required by it.
|
||||
*
|
||||
* Initialization of a derived instance involves calling all its parent
|
||||
* types instance initializers, so the class member of the instance
|
||||
* is altered during its initialization to always point to the class that
|
||||
* belongs to the type the current initializer was introduced for.
|
||||
*
|
||||
* The extended members of @instance are guaranteed to have been filled with
|
||||
* zeros before this function is called.
|
||||
*/
|
||||
typedef void (*GInstanceInitFunc) (GTypeInstance *instance,
|
||||
gpointer g_class);
|
||||
@@ -897,6 +901,9 @@ typedef void (*GInstanceInitFunc) (GTypeInstance *instance,
|
||||
* A callback function used by the type system to initialize a new
|
||||
* interface. This function should initialize all internal data and
|
||||
* allocate any resources required by the interface.
|
||||
*
|
||||
* The members of @iface_data are guaranteed to have been filled with
|
||||
* zeros before this function is called.
|
||||
*/
|
||||
typedef void (*GInterfaceInitFunc) (gpointer g_iface,
|
||||
gpointer iface_data);
|
||||
|
Reference in New Issue
Block a user