RE: gcc oriented questions



Title: RE: gcc oriented questions

> -----Original Message-----
> From: Daniel Elstner [mailto:daniel elstner gmx net]
> Sent: Wednesday, August 08, 2001 7:41 AM
> To: David Robin
> Cc: gtk-list gnome org
> Subject: Re: gcc oriented questions
>
>
> Am 08 Aug 2001 15:03:15 +0200 schrieb David Robin:
> > hi,
> >
> > here are two different questions:
> > - why are callback functions defined as 'static'? Is there
> an obligation to do so? Does it makes my app faster?
>
> Er, I guess you talking about static class members in C++ ?
> A static class member function behaves like an ordinary C function,
> e.g. it has no implicit "this"-pointer. Since the GTK+ C-API knows
> nothing about C++, you have to declare the callback functions static.
>
> > - can a C++/GTK+ app be as performant as its C/GTK+
> counterpart? If C is faster, is there a program that would
> translate my C++ sources to C (eg. class -> struct etc.)?
>
> That depends on your coding style, but generally: yes.
> A class doesn't have any implicit overhead compared to a struct,
> if you don't use virtual methods or virtual inheritence. In C++,
> a struct is the same as a class except that all members are by
> default "public" rather than "private".
>
> If you want to take advantage of C++ features, I'd suggest you
> have a look at libsigc++ and GTK--.
>
> http://gtkmm.sourceforge.net/
>
> Regards,
> --Daniel
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>

As a matter of fact I declared my callback functions as friend functions inside my classes and it worked.

Esteban Quijano Vincenzi
Artinsoft corp.
Phone: ++(506) 283-3144
Fax: (506) 283-2655
e-mail: equijano artinsoft com <equijano artinsoft com > 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]