[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Best code practice for new objects
- From: Emmanuele Bassi <ebassi gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Best code practice for new objects
- Date: Sun, 18 May 2008 12:52:44 +0100
On Sun, 2008-05-18 at 13:44 +0200, Nicola Fontana wrote:
> > > for every object, and this sounds me quite weird.
> >
> > why?
>
> Well, it was stinking as a useless struct.
in theory, you could even do:
typedef struct _MyParent MyInstance;
and it would be just as good.
> The GObject tutorial, if I caught it well, uses priv as a
> pointer you must alloc/dealloc by hand, and this will add a new
> malloc on every instantiation...
> not so good,
it's not incredibly expensive - especially if you are already allocating
stuff. it's rather pointless, though, and error-prone since GObject
allows private data to be bound to each instance.
> but maybe this is
> the old school.
the private data is available since GObject 2.6 or 2.8, as far as I
remember. in any case, it's *very* old school.
ciao,
Emmanuele.
--
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]