Re: Best practise inheritance
- From: Nicola Fontana <ntd entidi it>
- To: Tristan Van Berkom <tristan vanberkom codethink co uk>
- Cc: "S. Jacobi" <sjacobi mailueberfall de>, gtk-app-devel-list gnome org
- Subject: Re: Best practise inheritance
- Date: Tue, 21 Mar 2017 20:56:56 +0100
Il Tue, 21 Mar 2017 17:55:31 +0000 Tristan Van Berkom <tristan vanberkom codethink co uk> scrisse:
...
o I believe the lookups with G_TYPE_INSTANCE_GET_PRIVATE() are just
as cheap as the pointer dereference (as it will be implemented
using simple pointer arithmetic).
Hi Tristan,
the lookup indeed is quite expensive, and looking at the
implementation [1] it is not that straightforward.
The very same example provided by the official documentation [2]
caches that pointer into the instance struct.
[1] https://git.gnome.org/browse/glib/tree/gobject/gtype.c#n4709
[2] https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#g-type-class-add-private
Ciao.
--
Nicola
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]