Re: [gtk-list] Re: ANNOUNCE: C++ wrapper for glib (sorta)
- From: KC5TJA <kc5tja topaz axisinternet com>
- To: Gtk-List <gtk-list redhat com>
- Subject: Re: [gtk-list] Re: ANNOUNCE: C++ wrapper for glib (sorta)
- Date: Wed, 10 Jun 1998 10:17:32 -0700 (PDT)
> > public:
> > GList* alloc(void);
> > void free(GList *list);
> > void free_1(GList *list);
> > GList* append(GList *list, gpointer data);
> > GList* prepend(GList *list, gpointer data);
FATAL ERROR (Well...fatal to the compiler at least): No need to have the
initial GList *, since C++ passes this pointer by default (conveniently
called 'this').
> > Granted this is pretty sloppy (alloc/free should be contructor/destructor,
No, please don't: constructors should be for the C++ object itself, but
not for the GList itself. I'd prefer the separate allocators. The reason
is that GList::alloc() could FAIL (because the glib functions can,
themselves, return an error), then return an error as a result. A
constructor, on the other hand, does not return an error (C++ always
assumes constructors are successful). The most you can hope for is to
throw an exception in that case, and that is pretty sloppy in my opinion.
==========================================================================
KC5TJA/6 | -| TEAM DOLPHIN |-
DM13 | Samuel A. Falvo II
QRP-L #1447 | http://www.dolphin.openprojects.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]