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

Re: C vs C++ for GTK



On Mon, 2007-11-26 at 12:04 +0100, Dan H wrote:
> On Sun, 25 Nov 2007 00:03:14 +0100
> Tomas Carnecky <tom dbservice com> wrote:
> 
> > > Am I limited with C?
> > No, there are very few features in C++ that are hard/impossible to
> > imitate in C, but you usually won't need those for small projects.
> 
> In fact the GObject library (on which GTK is based) is an example of how full object-orientation can be achieved in C. Of course other C++ features like templates, operator overloading (ugh!) and namespaces are unique.
> 
> If you want to use C++ with GTK you can do so through gtkmm which, if I'm not mistaken, is essentially a wrapper around the assorted C libraries. So you end up with two redundant layers of object-orientation on top of each other which doesn't hurt a bit but which I find conceptually so abhorrent that, if I'd want to write C++ GUI apps, I'd use Qt.

The GObject system can be made to interface reasonable easily with C++
lifetime management by using some minimal wrapper classes - in
particular it is very straightforward to interface C++ smart pointers
with GOBject reference counting.

There are some utility classes at 
http://efax-gtk.cvs.sourceforge.net/efax-gtk/efax-gtk/src/utils/
which are quite handy if you want to program GTK+ in C++ without
additional language bindings.

Chris




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