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




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