Re: C vs C++ for GTK
- From: Benoît Dejean <benoit placenet org>
- To: Fernando Apesteguía <fernando apesteguia gmail com>
- Cc: gtk-app-devel-list gnome org, Tomas Carnecky <tom dbservice com>
- Subject: Re: C vs C++ for GTK
- Date: Mon, 26 Nov 2007 17:26:45 +0100
Le lundi 26 novembre 2007 Ã 15:56 +0100, Fernando ApesteguÃa a Ãcrit :
On 11/25/07, BenoÃt Dejean <benoit placenet org> wrote:
I've switched gnome-system-monitor to C++ and i'm very happy with it.
It's still 95% Gtk + 5% Gtkmm
Two questions about the sentence above:
- What improvements or benefits did you find to switch to C++?
- have real objects with methods. It helped me to better organize my
code which i failed with C even when i tried to fake OO. Simple class
with simple methods works great.
- was able to design some parts in a clean way with virtual functions.
- simplified a lot of code while moving datastructures from glib
(GArray, GList, etc) to STL (vector, list, set, etc).
- Gtkmm smart pointers helped me to fix/secure some g_object reference
counting issues.
- type safety
- some smart but simple template code instead of writing huge switch
aroung GValue.
C++ means less code.
You can almost write C and yet use some little and smart C++ techniques
to save code. I didn't rewrite anything. I made the C code compile in C
++ and then started cleanups. I believe in incremental improvement.
- Is it going to be a C++ application from now on?
It is since 2.17.x.
BTW: excellent application
There's still so many room for improvements :/
--
BenoÃt Dejean
GNOME http://www.gnomefr.org/
LibGTop http://directory.fsf.org/libgtop.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]