C vs C++ for GTK

2007-11-24 Thread Patrick
Hi Everyone.

Sorry for the flame war bait, I know how passionate language debates 
get  but I need some guidance. I am using PyGTK right now and I am happy 
with it, but a day is coming soon were the speed limitations and 
less-then-straight-forward threading will be an issue.

I figure my next move should be to learn C or C++. I would like to stay 
up-to-date with things and I would like to be able to reuse GTK code 
from other Apps.

I thought that C++ must be the way to go as it can do everything that C 
can "plus plus" but some heavy hitters don't seem enthused with it, 
Linus Torvalds in particular has been quoted as calling it a "horrible 
language".

I can only spend 8-12 hours a week programming, I am not a professional 
programmer, is C++ to complicated? Is C going out of date? Am I limited 
with C?

Thanks-Patrick




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-24 Thread Tomas Carnecky
Patrick wrote:
> is C++ to complicated? 
C++ is more complex than C, and thus harder to fully understand.

> Is C going out of date?
No, it's still being used for lots of projects.

> 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.

What people prefer mostly depends on their taste. I do C, my brother
does C++, I can't say why that is.

Since you worked with python which is object oriented I would imagine
going with C++ will be easier for you during the first weeks.

tom
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-24 Thread Chris Sparks
Not trying to start a language flame war but I always prefer Ada.  And 
no it hasn't gone
away either! ;-)

Chris
> Patrick wrote:
>   
>> is C++ to complicated? 
>> 
> C++ is more complex than C, and thus harder to fully understand.
>
>   
>> Is C going out of date?
>> 
> No, it's still being used for lots of projects.
>
>   
>> 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.
>
> What people prefer mostly depends on their taste. I do C, my brother
> does C++, I can't say why that is.
>
> Since you worked with python which is object oriented I would imagine
> going with C++ will be easier for you during the first weeks.
>
> tom
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-24 Thread Allin Cottrell
On Sat, 24 Nov 2007, Patrick wrote:

> Sorry for the flame war bait, I know how passionate language debates 
> get  but I need some guidance. I am using PyGTK right now and I am happy 
> with it, but a day is coming soon were the speed limitations and 
> less-then-straight-forward threading will be an issue.
> 
> I figure my next move should be to learn C or C++. I would like to stay 
> up-to-date with things and I would like to be able to reuse GTK code 
> from other Apps.
> 
> I thought that C++ must be the way to go as it can do everything that C 
> can "plus plus" but some heavy hitters don't seem enthused with it, 

I'll restrict myself to the factual.  

C++ is almost but not exactly a superset of C.  However, don't let 
that fool you into thinking that if you learn C++ you've 
automatically learned C as a bonus.  The programming idioms are 
quite different in the two languages.  

One reason for going with C is that the great bulk of free 
software is in C, including GLib and GTK.  The main exception 
is Qt, the basis for KDE.  So if you might want to get into KDE 
programming, maybe learning C++ would be better.

Allin Cottrell.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-24 Thread Patrick
Patrick wrote:
> Hi Allin
>
> I have no interest in QT.
>
> Your points are very strong.
>
> If most of the free/libre software is in C then I better stick with C, 
> especially if learning C++ does not guarantee an understanding of 
> plain C.
>
> Thanks very much for your help, it's easy to keep going around in 
> circles over these sorts of things, you have saved me a lot of time.
>
> Have a great weekend-Patrick
>
> P.S thanks to everyone else that posted too!
>
> Allin Cottrell wrote:
>> On Sat, 24 Nov 2007, Patrick wrote:
>>
>>> Sorry for the flame war bait, I know how passionate language debates 
>>> get but I need some guidance. I am using PyGTK right now and I am 
>>> happy with it, but a day is coming soon were the speed limitations 
>>> and less-then-straight-forward threading will be an issue.
>>>
>>> I figure my next move should be to learn C or C++. I would like to 
>>> stay up-to-date with things and I would like to be able to reuse GTK 
>>> code from other Apps.
>>>
>>> I thought that C++ must be the way to go as it can do everything 
>>> that C can "plus plus" but some heavy hitters don't seem enthused 
>>> with it, 
>>
>> I'll restrict myself to the factual.
>> C++ is almost but not exactly a superset of C. However, don't let 
>> that fool you into thinking that if you learn C++ you've 
>> automatically learned C as a bonus. The programming idioms are quite 
>> different in the two languages.
>> One reason for going with C is that the great bulk of free software 
>> is in C, including GLib and GTK. The main exception is Qt, the basis 
>> for KDE. So if you might want to get into KDE programming, maybe 
>> learning C++ would be better.
>>
>> Allin Cottrell.
>>
>
>

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-25 Thread Tomas Carnecky
Allin Cottrell wrote:
> One reason for going with C is that the great bulk of free 
> software is in C, including GLib and GTK.  The main exception 
> is Qt, the basis for KDE.  So if you might want to get into KDE 
> programming, maybe learning C++ would be better.

You can use gtk in C++, there's gtkmm which is a thin wrapper on top of
gtk! Many good gtk apps are written in gtk. So actually when using gtk
you are less restricted in your programing language choice than with Qt.

tom
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-25 Thread Tomas Carnecky
Tomas Carnecky wrote:
> Allin Cottrell wrote:
>> One reason for going with C is that the great bulk of free 
>> software is in C, including GLib and GTK.  The main exception 
>> is Qt, the basis for KDE.  So if you might want to get into KDE 
>> programming, maybe learning C++ would be better.
> 
> You can use gtk in C++, there's gtkmm which is a thin wrapper on top of
> gtk! Many good gtk apps are written in gtk. So actually when using gtk
 ^^^
 C++

> you are less restricted in your programing language choice than with Qt.
> 
> tom

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-25 Thread Benoît Dejean

Le dimanche 25 novembre 2007 à 00:03 +0100, Tomas Carnecky a écrit :
> Patrick wrote:
> > is C++ to complicated? 
> C++ is more complex than C, and thus harder to fully understand.
> 
> > Is C going out of date?
> No, it's still being used for lots of projects.
> 
> > 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.

You can also do it in assembly if you have time.

> What people prefer mostly depends on their taste. I do C, my brother
> does C++, I can't say why that is.
> 
> Since you worked with python which is object oriented I would imagine
> going with C++ will be easier for you during the first weeks.

I've switched gnome-system-monitor to C++ and i'm very happy with it.
-- 
Benoît Dejean
GNOME http://www.gnomefr.org/
LibGTop http://directory.fsf.org/libgtop.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Neil Bird
Around about 25/11/07 12:31, Benoît Dejean typed ...
> I've switched gnome-system-monitor to C++ and i'm very happy with it.

   Just out of interest, did you choose GTKmm or C++ with vanilla GTK+?

   I'm looking at doing some GTK from C++ (I've previously only really used 
GTK+ from C), and on the odd occasion I've dipped into GTKmm projects, I've 
been worried about what looked like the obfuscation of the GTK innards 
which, although arguably necessary to give a C++ methodology to the 
proceedings, made it very difficult to pin down a [seeming] GTK/GTKmm bug 
(which I never did, in fact).

-- 
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Dan H
On Sun, 25 Nov 2007 00:03:14 +0100
Tomas Carnecky <[EMAIL PROTECTED]> 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.

I prefer C and GTK+ though.

--D.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Gian Mario Tagliaretti
2007/11/24, Patrick <[EMAIL PROTECTED]>:

Hi Patrick,

> I can only spend 8-12 hours a week programming, I am not a professional
> programmer, is C++ to complicated? Is C going out of date? Am I limited
> with C?

Before to switch to a new language are you sure that python is so slow
that you can't use it? 99% of the times it's not the case.

Same apply to threads, 99% of the times you don' t need them.

cheers
-- 
Gian Mario Tagliaretti
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Fernando Apesteguía
On 11/25/07, Benoît Dejean <[EMAIL PROTECTED]> wrote:
>
> Le dimanche 25 novembre 2007 à 00:03 +0100, Tomas Carnecky a écrit :
> > Patrick wrote:
> > > is C++ to complicated?
> > C++ is more complex than C, and thus harder to fully understand.
> >
> > > Is C going out of date?
> > No, it's still being used for lots of projects.
> >
> > > 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.
>
> You can also do it in assembly if you have time.
>
> > What people prefer mostly depends on their taste. I do C, my brother
> > does C++, I can't say why that is.
> >
> > Since you worked with python which is object oriented I would imagine
> > going with C++ will be easier for you during the first weeks.
>
> I've switched gnome-system-monitor to C++ and i'm very happy with it.

Two questions about the sentence above:

- What improvements or benefits did you find to switch to C++?

- Is it going to be a C++ application from now on?

BTW: excellent application

> --
> Benoît Dejean
> GNOME http://www.gnomefr.org/
> LibGTop http://directory.fsf.org/libgtop.html
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Benoît Dejean

Le lundi 26 novembre 2007 à 15:56 +0100, Fernando Apesteguía a écrit :
> On 11/25/07, Benoît Dejean <[EMAIL PROTECTED]> 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
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Benoît Dejean

Le dimanche 25 novembre 2007 à 10:47 +0100, Tomas Carnecky a écrit :
> Allin Cottrell wrote:
> > One reason for going with C is that the great bulk of free 
> > software is in C, including GLib and GTK.  The main exception 
> > is Qt, the basis for KDE.  So if you might want to get into KDE 
> > programming, maybe learning C++ would be better.
> 
> You can use gtk in C++, there's gtkmm which is a thin wrapper on top of
> gtk! Many good gtk apps are written in gtk. So actually when using gtk
> you are less restricted in your programing language choice than with Qt.

I wouldn't call GTKmm thin. It's smart and changes the way you can use
GTK+. The best example is treeview: in C or python, they are not
typesafe, i.e. you can get runtime errors because you inserted the
wrong datatype in the wrong column. Gtkmm provides typesafe treeview at
compile type. This is amazing.
-- 
Benoît Dejean
GNOME http://www.gnomefr.org/
LibGTop http://directory.fsf.org/libgtop.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Benoît Dejean

Le lundi 26 novembre 2007 à 08:39 +, Neil Bird a écrit :
> Around about 25/11/07 12:31, Benoît Dejean typed ...
> > I've switched gnome-system-monitor to C++ and i'm very happy with it.
> 
>Just out of interest, did you choose GTKmm or C++ with vanilla GTK+?

As i didn't start from scratch, that's still a lot of GTk+.

>I'm looking at doing some GTK from C++ (I've previously only really used 
> GTK+ from C), and on the odd occasion I've dipped into GTKmm projects, I've 
> been worried about what looked like the obfuscation of the GTK innards 
> which, although arguably necessary to give a C++ methodology to the 
> proceedings, made it very difficult to pin down a [seeming] GTK/GTKmm bug 
> (which I never did, in fact).

That's not my experience. I spend hours debugging gtk stuff because C is
not typesafe or because i freed the wrong thing at the wrong time.

-- 
Benoît Dejean
GNOME http://www.gnomefr.org/
LibGTop http://directory.fsf.org/libgtop.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Benoît Dejean

Le lundi 26 novembre 2007 à 12:04 +0100, Dan H a écrit :
> On Sun, 25 Nov 2007 00:03:14 +0100
> Tomas Carnecky <[EMAIL PROTECTED]> 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.

This is totally a blocker for beginners. I've been doing some GNOME for
years and i've never wrote any gobject thing because it didn't worth to
waste time on it.

> 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.

C is a kind of subset of C++, if you want to use GTK+ from C++, you can
do it exactly the same way.
-- 
Benoît Dejean
GNOME http://www.gnomefr.org/
LibGTop http://directory.fsf.org/libgtop.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
Benoît Dejean wrote:
>> 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.
> 
> This is totally a blocker for beginners. I've been doing some GNOME for
> years and i've never wrote any gobject thing because it didn't worth to
> waste time on it.
> 
Another interesting idea is to use Vala[1] for developing Gobject code.
 This compiles to straight C and you can use the new object's api like
any other gobject-based api.  Vala's intriguing because it's a language
very much like C#, but compiles down to straight C, which can be a
really good thing.

[1] http://live.gnome.org/Vala/GTKSample

-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
Patrick wrote:
> Hi Everyone.
> 
> Sorry for the flame war bait, I know how passionate language debates 
> get  but I need some guidance. I am using PyGTK right now and I am happy 
> with it, but a day is coming soon were the speed limitations and 
> less-then-straight-forward threading will be an issue.

I don't see any reason at all why a GUI done with PyGTK should be any
slower than a GUI done with straight C.  Thus I don't see any compelling
reason to abandon Python for C or C++.

That said, however, Python sometimes isn't the right language to use for
computationally-intensive tasks.

Personally I think you are going about this the wrong way.  You could be
wanting to do premature optimization.  Rather than trying to replace
python, you should consider either extending python with C or C++, to
replace the slowest and most-used computational paths, and stick with
python for everything else. It's very easy to write python modules in C
(10 hours to learn), or C++ (Boost makes it easy to wrap C++ classes and
functions).  Alternatively you can code in C or C++ and embed Python to
drive your GUI.

> 
> I figure my next move should be to learn C or C++. I would like to stay 
> up-to-date with things and I would like to be able to reuse GTK code 
> from other Apps.

When it comes to the basic API, translating a code-generated GUI between
python and C++ (with GTKmm) should be very simple.  Even translating it
to C won't be that hard either, except that you don't have an easy way
to bind callbacks to a particular instance of data without some work,
like setting data values and using the void *data argument on the callbacks.

> 
> I thought that C++ must be the way to go as it can do everything that C 
> can "plus plus" but some heavy hitters don't seem enthused with it, 
> Linus Torvalds in particular has been quoted as calling it a "horrible 
> language".

>From my experience it is those that don't understand C++ and how to
wield it that describe it that way.  Torvalds is biased anyway, since
he's focused on kernel programming.

> 
> I can only spend 8-12 hours a week programming, I am not a professional 
> programmer, is C++ to complicated? Is C going out of date? Am I limited 
> with C?

C++ is complicated, but not overly so.  I feel that coming from Python,
C++ is probably going to be easier for you to move to than C.

Again, though, I think

> 
> Thanks-Patrick
> 
> 
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Patrick
Hi Micheal

Indeed, good advice!

I am planning on using Python for everything I can. I just need a little 
extra speed for data collection and threading during collection.

I think I will learn C so that I can re-use code from other open source 
projects.

All of this advice has been great, thanks to you and to everyone that 
posted!

-Patrick

Michael L Torrie wrote:
> Patrick wrote:
>   
>> Hi Everyone.
>>
>> Sorry for the flame war bait, I know how passionate language debates 
>> get  but I need some guidance. I am using PyGTK right now and I am happy 
>> with it, but a day is coming soon were the speed limitations and 
>> less-then-straight-forward threading will be an issue.
>> 
>
> I don't see any reason at all why a GUI done with PyGTK should be any
> slower than a GUI done with straight C.  Thus I don't see any compelling
> reason to abandon Python for C or C++.
>
> That said, however, Python sometimes isn't the right language to use for
> computationally-intensive tasks.
>
> Personally I think you are going about this the wrong way.  You could be
> wanting to do premature optimization.  Rather than trying to replace
> python, you should consider either extending python with C or C++, to
> replace the slowest and most-used computational paths, and stick with
> python for everything else. It's very easy to write python modules in C
> (10 hours to learn), or C++ (Boost makes it easy to wrap C++ classes and
> functions).  Alternatively you can code in C or C++ and embed Python to
> drive your GUI.
>
>   
>> I figure my next move should be to learn C or C++. I would like to stay 
>> up-to-date with things and I would like to be able to reuse GTK code 
>> from other Apps.
>> 
>
> When it comes to the basic API, translating a code-generated GUI between
> python and C++ (with GTKmm) should be very simple.  Even translating it
> to C won't be that hard either, except that you don't have an easy way
> to bind callbacks to a particular instance of data without some work,
> like setting data values and using the void *data argument on the callbacks.
>
>   
>> I thought that C++ must be the way to go as it can do everything that C 
>> can "plus plus" but some heavy hitters don't seem enthused with it, 
>> Linus Torvalds in particular has been quoted as calling it a "horrible 
>> language".
>> 
>
> >From my experience it is those that don't understand C++ and how to
> wield it that describe it that way.  Torvalds is biased anyway, since
> he's focused on kernel programming.
>
>   
>> I can only spend 8-12 hours a week programming, I am not a professional 
>> programmer, is C++ to complicated? Is C going out of date? Am I limited 
>> with C?
>> 
>
> C++ is complicated, but not overly so.  I feel that coming from Python,
> C++ is probably going to be easier for you to move to than C.
>
> Again, though, I think
>
>   
>> Thanks-Patrick
>>
>>
>>
>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>> 
>
>
>   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fw: C vs C++ for GTK

2007-11-26 Thread JAMES SCOTT


- Forwarded Message 
From: JAMES SCOTT <[EMAIL PROTECTED]>
To: Michael L Torrie <[EMAIL PROTECTED]>
Sent: Monday, November 26, 2007 2:37:18 PM
Subject: Re: C vs C++ for GTK

To list members following this subject: I have a question - not a flame, as I 
try to understand the diversity of responses to this topic.

How many of you who have suggested "Patrick" learn something other than C, know 
C already for yourself.  Over the course of my experience I have found that 
learning assembler and C for a given platform has helped me better understand 
and use that platform.  Also, knowing C make picking up or reading other 
languages like - python, php, perl, and many others easier.

I'm assuming that, those of you who are pointing another way - already know C!  
Why not let Patrick follow your well worn path through C/GLIB/GTK2, maybe he 
will come out afterwards to C++,
 Python, or some other door.

Yes, my preference is C/GLib/Gtk+.  But I use lots of other when needed.

James,
"Just another Hobbyist and Professional Developer: 35+ years"

- Original Message 
From: Michael L Torrie <[EMAIL PROTECTED]>
To: Patrick <[EMAIL PROTECTED]>
Cc: gtk-app-devel-list@gnome.org
Sent: Monday, November 26, 2007 1:11:07 PM
Subject: Re: C vs C++ for GTK

Patrick wrote:
> Hi Everyone.
> 
> Sorry for the flame war bait, I know how passionate language debates 
> get  but I need some guidance. I am using PyGTK right now and I am
 happy 
> with it, but a day is coming soon were the speed limitations and 
> less-then-straight-forward threading will be an issue.

I don't see any reason at all why a GUI done with PyGTK should be any
slower than a GUI done with straight C.  Thus I don't see any
 compelling
reason to abandon Python for C or C++.

That said, however, Python sometimes isn't the right language to use
 for
computationally-intensive tasks.

Personally I think you are going about this the wrong way.  You could
 be
wanting to do premature optimization.  Rather than trying to replace
python, you should consider either extending python with C or C++, to
replace the slowest and most-used computational paths, and stick with
python for everything else. It's very easy to write python modules in C
(10 hours to learn), or C++ (Boost makes it easy to wrap C++ classes
 and
functions).  Alternatively you can code in C or C++ and embed Python to
drive your GUI.

> 
> I figure my next move should be to learn C or C++. I would like to
 stay 
> up-to-date with things and I would like to be able to reuse GTK code 
> from other Apps.

When it comes to the basic API, translating a code-generated GUI
 between
python and C++ (with GTKmm) should be very simple.  Even translating it
to C won't be that hard either, except that you don't have an easy way
to bind callbacks to a particular instance of data without some work,
like setting data values and using the void *data argument on the
 callbacks.

> 
> I thought that C++ must be the way to go as it can do everything that
 C 
> can "plus plus" but some heavy hitters don't seem enthused with it, 
> Linus Torvalds in particular has been quoted as calling it a
 "horrible 
> language".

>From my experience it is those that don't understand C++ and how to
wield it that describe it that way.  Torvalds is biased anyway, since
he's focused on kernel programming.

> 
> I can only spend 8-12 hours a week programming, I am not a
 professional 
> programmer, is C++ to complicated? Is C going out of date? Am I
 limited 
> with C?

C++ is complicated, but not overly so.  I feel that coming from Python,
C++ is probably going to be easier for you to move to than C.

Again, though, I think

> 
> Thanks-Patrick
> 
> 
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
JAMES SCOTT wrote:
> To list members following this subject: I have a question - not a
> flame, as I try to understand the diversity of responses to this
> topic.
> 
> How many of you who have suggested "Patrick" learn something other
> than C, know C already for yourself.  Over the course of my
> experience I have found that learning assembler and C for a given
> platform has helped me better understand and use that platform.
> Also, knowing C make picking up or reading other languages like -
> python, php, perl, and many others easier.

I agree to a point. C isn't going to teach you much about list
processing (a la LISP), domain-specific languages, lambda closures,
proper variable binding, functional programming, etc.

On the other hand, C helps one learn to manage resources explicitly
(even garbage collection can bite you if you don't understand how
resource management works), pointers, etc.

The ideal computer science program would make sure one first knows (IE
is taught) C, then some assembly, then Scheme, then Python.

> 
> I'm assuming that, those of you who are pointing another way -
> already know C!  Why not let Patrick follow your well worn path
> through C/GLIB/GTK2, maybe he will come out afterwards to C++,
> Python, or some other door.

Too late for that!  Patrick's already well into Python.  Python is a
great language to learn on, in my opinion.  It's as instructive as
learning LISP or Scheme, but as useful as C or C++, or even Java.  I get
the impression that Patrick already has some C proficiency.

> 
> Yes, my preference is C/GLib/Gtk+.  But I use lots of other when needed.

I'm coming to the opinion that a good rule of thumb is just to always
use python unless specific needs dictate otherwise.  Writing GUI code in
a low-level, compiled language just doesn't seem to be the wisest thing
to do these days.

That's not to say that you're advice to learn assembly and C isn't good.
 In fact it's important for all computer programmers to know, in my opinion.

When I have to write in C, Glib is a godsend.  And of course GTK+ for
the GUI.  Using Glib, I wrote a very complicated data parsing program
using dynamic strings, hash tables, and tree structures all with Glib
and only had one very small memory leak in 10,000 lines of code and
building and destroying many trees.


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread Chris Vine

On Mon, 2007-11-26 at 12:04 +0100, Dan H wrote:
> On Sun, 25 Nov 2007 00:03:14 +0100
> Tomas Carnecky <[EMAIL PROTECTED]> 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


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-26 Thread JAMES SCOTT
Michael,

Thanks for the feedback, it seems we are on the same page on several counts.  

James,
- Original Message 
From: Michael L Torrie <[EMAIL PROTECTED]>
To: gtk-app-devel-list@gnome.org
Sent: Monday, November 26, 2007 5:32:22 PM
Subject: Re: C vs C++ for GTK


JAMES SCOTT wrote:
> To list members following this subject: I have a question - not a
> flame, as I try to understand the diversity of responses to this
> topic.
> 
> How many of you who have suggested "Patrick" learn something other
> than C, know C already for yourself.  Over the course of my
> experience I have found that learning assembler and C for a given
> platform has helped me better understand and use that platform.
> Also, knowing C make picking up or reading other languages like -
> python, php, perl, and many others easier.

I agree to a point. C isn't going to teach you much about list
processing (a la LISP), domain-specific languages, lambda closures,
proper variable binding, functional programming, etc.

On the other hand, C helps one learn to manage resources explicitly
(even garbage collection can bite you if you don't understand how
resource management works), pointers, etc.

The ideal computer science program would make sure one first knows (IE
is taught) C, then some assembly, then Scheme, then Python.

> 
> I'm assuming that, those of you who are pointing another way -
> already know C!  Why not let Patrick follow your well worn path
> through C/GLIB/GTK2, maybe he will come out afterwards to C++,
> Python, or some other door.

Too late for that!  Patrick's already well into Python.  Python is a
great language to learn on, in my opinion.  It's as instructive as
learning LISP or Scheme, but as useful as C or C++, or even Java.  I
 get
the impression that Patrick already has some C proficiency.

> 
> Yes, my preference is C/GLib/Gtk+.  But I use lots of other when
 needed.

I'm coming to the opinion that a good rule of thumb is just to always
use python unless specific needs dictate otherwise.  Writing GUI code
 in
a low-level, compiled language just doesn't seem to be the wisest thing
to do these days.

That's not to say that you're advice to learn assembly and C isn't
 good.
 In fact it's important for all computer programmers to know, in my
 opinion.

When I have to write in C, Glib is a godsend.  And of course GTK+ for
the GUI.  Using Glib, I wrote a very complicated data parsing program
using dynamic strings, hash tables, and tree structures all with Glib
and only had one very small memory leak in 10,000 lines of code and
building and destroying many trees.


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-27 Thread Alan Lake
Just .02 € from a programmer who's been doing it for about 40 years. I 
agree with most of what has been said on this thread. My thought is that 
object-oriented thinking is entirely different from procedural thinking. 
I think that one needs to settle on one paradigm or the other and stay 
with it.

Personally, I'm using Ruby and like it very much. The reason is that it 
allows me to concentrate on the project at hand rather than the details 
of its implementation. There are occasions when a low level language 
like C++ is needed, but why twiddle bits when bit twiddling only gets in 
your way? IMHO, it is the true scientist who will use either C or C++, 
because of the low level of code access. The question is, "Do you want 
to drive a car, customize a car or design a car?" None is better than 
the others. They are different disciplines.

GTK is written in C, I do believe, so the person programming in C can 
get up close and personal with it. My Ruby-Gnome package wraps the C 
code, so I can't get down and see exactly what GTK, as written, is 
doing, but, then, I've not needed to.

Regarding the reference to euros. I'm an American living in Finland.

Alan

JAMES SCOTT wrote:
> Michael,
>
> Thanks for the feedback, it seems we are on the same page on several counts.  
>
> James,
> - Original Message 
> From: Michael L Torrie <[EMAIL PROTECTED]>
> To: gtk-app-devel-list@gnome.org
> Sent: Monday, November 26, 2007 5:32:22 PM
> Subject: Re: C vs C++ for GTK
>
>
> JAMES SCOTT wrote:
>   
>> To list members following this subject: I have a question - not a
>> flame, as I try to understand the diversity of responses to this
>> topic.
>>
>> How many of you who have suggested "Patrick" learn something other
>> than C, know C already for yourself.  Over the course of my
>> experience I have found that learning assembler and C for a given
>> platform has helped me better understand and use that platform.
>> Also, knowing C make picking up or reading other languages like -
>> python, php, perl, and many others easier.
>> 
>
> I agree to a point. C isn't going to teach you much about list
> processing (a la LISP), domain-specific languages, lambda closures,
> proper variable binding, functional programming, etc.
>
> On the other hand, C helps one learn to manage resources explicitly
> (even garbage collection can bite you if you don't understand how
> resource management works), pointers, etc.
>
> The ideal computer science program would make sure one first knows (IE
> is taught) C, then some assembly, then Scheme, then Python.
>
>   
>> I'm assuming that, those of you who are pointing another way -
>> already know C!  Why not let Patrick follow your well worn path
>> through C/GLIB/GTK2, maybe he will come out afterwards to C++,
>> Python, or some other door.
>> 
>
> Too late for that!  Patrick's already well into Python.  Python is a
> great language to learn on, in my opinion.  It's as instructive as
> learning LISP or Scheme, but as useful as C or C++, or even Java.  I
>  get
> the impression that Patrick already has some C proficiency.
>
>   
>> Yes, my preference is C/GLib/Gtk+.  But I use lots of other when
>> 
>  needed.
>
> I'm coming to the opinion that a good rule of thumb is just to always
> use python unless specific needs dictate otherwise.  Writing GUI code
>  in
> a low-level, compiled language just doesn't seem to be the wisest thing
> to do these days.
>
> That's not to say that you're advice to learn assembly and C isn't
>  good.
>  In fact it's important for all computer programmers to know, in my
>  opinion.
>
> When I have to write in C, Glib is a godsend.  And of course GTK+ for
> the GUI.  Using Glib, I wrote a very complicated data parsing program
> using dynamic strings, hash tables, and tree structures all with Glib
> and only had one very small memory leak in 10,000 lines of code and
> building and destroying many trees.
>
>
>   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-27 Thread Dan H
On Mon, 26 Nov 2007 21:12:17 -0800 (PST)
JAMES SCOTT <[EMAIL PROTECTED]> wrote:

> When I have to write in C, Glib is a godsend.

Yes! When I came back to C from C++ (I had done a large project for which C++ 
was ideally suited, but I like C much better) the thing I missed most was the 
STL. I was happy to discover GLib.

And GObject really taught me about the nuts and bolts behind OO programming, 
but if I again had a project that screamed for OO, I'd use C++ again. 
Implementing OO in C is just too tiresome.

--D.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-11-27 Thread Junior Polegato - GTK+ & GTKmm
Alan Lake escreveu:
> The question is, "Do you want to drive a car, customize a car or design a 
> car?" None is better than 
> the others. They are different disciplines.
>   
Hi, I think like you. The best language is the one you know and solves 
your problem. See aMSN, where his mentor only studied tcl / tk, created 
it and it is famous. I use GTK+, GTKmm, PyGTK, PhpGTK, ...GTK and this 
does not make me a better or worse programmer, just have more open doors.

  


-- 
Yours Truly,

   Junior Polegato

   A pilgrim of problems; A parchment of solutions!
   Professional Page: http://www.juniorpolegato.com.br

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-12 Thread Jon Harrop
On Saturday 24 November 2007 22:11, Patrick wrote:
> Hi Everyone.
>
> Sorry for the flame war bait, I know how passionate language debates
> get  but I need some guidance. I am using PyGTK right now and I am happy
> with it, but a day is coming soon were the speed limitations...

You might like to look at OCaml and the LablGTK2 bindings to GTK+. OCaml is 
high-level like Python and fast like C++.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-12 Thread Daniel Dieterle
On Mon, 2007-11-26 at 16:48 +, Jon Harrop wrote:
> On Saturday 24 November 2007 22:11, Patrick wrote:
> > I thought that C++ must be the way to go as it can do everything that C
> > can "plus plus" but some heavy hitters don't seem enthused with it,
> > Linus Torvalds in particular has been quoted as calling it a "horrible
> > language".
> 
> IIRC, Linus said that specifically in the context of systems programming.
> 
> My recommendation is to choose a garbage collected language for GUI work as 
> it 
> makes everything so much easier. Lots of GCd languages have GTK bindings 
> these days.
> 
> Incidentally, has anyone tried GTK# from C# on Mono?
Yeah,

works great and easy to use.

Daniel.
> 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-12 Thread Jon Harrop
On Saturday 24 November 2007 22:11, Patrick wrote:
> I thought that C++ must be the way to go as it can do everything that C
> can "plus plus" but some heavy hitters don't seem enthused with it,
> Linus Torvalds in particular has been quoted as calling it a "horrible
> language".

IIRC, Linus said that specifically in the context of systems programming.

My recommendation is to choose a garbage collected language for GUI work as it 
makes everything so much easier. Lots of GCd languages have GTK bindings 
these days.

Incidentally, has anyone tried GTK# from C# on Mono?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-12 Thread Dan H
On Mon, 26 Nov 2007 16:48:05 +
Jon Harrop <[EMAIL PROTECTED]> wrote:

> My recommendation is to choose a garbage collected language for GUI
> work as it makes everything so much easier. Lots of GCd languages
> have GTK bindings these days.

Just for the record, garbage collection (which is a good idea) doesn't have to 
be a feature of the language itself (it isn't for C++, by the way). Just build 
and link your C (or C++) program with libgc (the renowned Boehm garbage 
collector) and you're fine.

--D.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-12 Thread Michael L Torrie
Jon Harrop wrote:
> On Saturday 24 November 2007 22:11, Patrick wrote:
>> I thought that C++ must be the way to go as it can do everything that C
>> can "plus plus" but some heavy hitters don't seem enthused with it,
>> Linus Torvalds in particular has been quoted as calling it a "horrible
>> language".
> 
> IIRC, Linus said that specifically in the context of systems programming.
> 
> My recommendation is to choose a garbage collected language for GUI work as 
> it 
> makes everything so much easier. Lots of GCd languages have GTK bindings 
> these days.

Just because a language or library implements garbage collection doesn't
mean you don't need to manage resources.  Especially when you're working
with a GUI.  It's totally possible to leak memory in Python, C# or any
other managed language if you don't know what you are doing.  It's a bit
harder, but still a problem.  Recently the Darpa autonomous vehicle
challenge was lost by one group because their C# control system was
leaking very badly, requiring a restart every 30 minutes or so.

GTKmm is based on some very nice C++ abstractions around pointers,
providing many of the same benefits as any managed language with pure
C++.  They are called smart pointers and for GUI development, they work
very very well.  I find GTK in C++ to be almost as productive as python
or C#

> 
> Incidentally, has anyone tried GTK# from C# on Mono?

Yup.  It works awesomely well.  It's very clean.  Of course I can't
think of many reasons to do it anymore.  I use python most of the time now.

> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-13 Thread Dan H
On Wed, 12 Dec 2007 09:26:25 -0700
Michael L Torrie <[EMAIL PROTECTED]> wrote:

> GTKmm is based on some very nice C++ abstractions around pointers,
> providing many of the same benefits as any managed language with
> pure C++.  They are called smart pointers and for GUI development,
> they work very very well.

Isn't "smart pointers" just a reference counting scheme?

--D.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-13 Thread Michael L Torrie
Dan H wrote:
> On Wed, 12 Dec 2007 09:26:25 -0700
> Michael L Torrie <[EMAIL PROTECTED]> wrote:
> 
>> GTKmm is based on some very nice C++ abstractions around pointers,
>> providing many of the same benefits as any managed language with
>> pure C++.  They are called smart pointers and for GUI development,
>> they work very very well.
> 
> Isn't "smart pointers" just a reference counting scheme?

Yup.  Poor-man's garbage collection.  Turns out to be just the ticket,
though, for GUI programming.  Because of that, I'd put productivity with
GTKmm to be right up there with PyGTK or GTK#.

> 
> --D.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-13 Thread Dan H
On Thu, 13 Dec 2007 11:40:41 -0700
Michael L Torrie <[EMAIL PROTECTED]> wrote:

> Dan H wrote:

> > Isn't "smart pointers" just a reference counting scheme?
> 
> Yup.  Poor-man's garbage collection.  Turns out to be just the
> ticket, though, for GUI programming.  Because of that, I'd put
> productivity with GTKmm to be right up there with PyGTK or GTK#.

Reference counting is already a feature of the underlying GTK+/C layer. As 
always somewhat more verbose than C++.

--D.


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-13 Thread Murray Cumming

On Thu, 2007-12-13 at 22:06 +0100, Dan H wrote:
> On Thu, 13 Dec 2007 11:40:41 -0700
> Michael L Torrie <[EMAIL PROTECTED]> wrote:
> 
> > Dan H wrote:
> 
> > > Isn't "smart pointers" just a reference counting scheme?
> > 
> > Yup.  Poor-man's garbage collection.  Turns out to be just the
> > ticket, though, for GUI programming.  Because of that, I'd put
> > productivity with GTKmm to be right up there with PyGTK or GTK#.
> 
> Reference counting is already a feature of the underlying GTK+/C layer. As 
> always somewhat more verbose than C++.

The difference is that GTK+ in C requires you to think about it. And you
will make a mistake that will be difficult to debug. But with gtkmm you
don't need to think about it and you can't get it wrong. (There are
plenty of other things you can get wrong instead, in any language.)

-- 
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-18 Thread Jon Harrop
On Wednesday 12 December 2007 15:19, Dan H wrote:
> Jon Harrop <[EMAIL PROTECTED]> wrote:
> > My recommendation is to choose a garbage collected language for GUI
> > work as it makes everything so much easier. Lots of GCd languages
> > have GTK bindings these days.
>
> Just for the record, garbage collection (which is a good idea) doesn't have
> to be a feature of the language itself (it isn't for C++, by the way). Just
> build and link your C (or C++) program with libgc (the renowned Boehm
> garbage collector) and you're fine.

I would strongly recommend choosing a language that provides accurate GC 
rather than using something like Boehm's GC with C/C++. The main reason is 
that using Boehm on C/C++ code that wasn't designed for Boehm can break 
working code (see, for example, numerical recipies). Another reason is that 
languages designed to be GCd will be a lot faster.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: C vs C++ for GTK

2007-12-18 Thread Jon Harrop
On Thursday 13 December 2007 08:28, Dan H wrote:
> On Wed, 12 Dec 2007 09:26:25 -0700
> Michael L Torrie <[EMAIL PROTECTED]> wrote:
> > GTKmm is based on some very nice C++ abstractions around pointers,
> > providing many of the same benefits as any managed language with
> > pure C++.  They are called smart pointers and for GUI development,
> > they work very very well.
>
> Isn't "smart pointers" just a reference counting scheme?

Exactly, yes. It is no substitute for accurate GC, of course.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list