Re: [gtk-list] Re: Why is gtk+ written in C?
- From: Paul Miller <Paul_Miller avid com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Why is gtk+ written in C?
- Date: Wed, 14 Oct 1998 09:28:31 -0400
> > One of the questions I got asked is "Why is gtk+ written in C?" This
> C++ is a lumbering oafish mess that eats resources and pisses people off.
There is one HUGE benefit and one HUGE drawback with using C++ (which
I'm surprised nobody has pointed out yet - probably due to my using C++
all day :-) (and the only time it pisses me off is when we upgrade our
VC++ compiler and it breaks half the language - but that's a different
topic).
HUGE benefit: code would actually be MORE portable. C++ has a lot more
type-safety and compile-time checking than "C". This would probably help
to avoid the shear frustration people have with attempting to even get
gtk to compile with their (supposedly standard "C") compiler. C++
doesn't even allow anastranistic things such as pointer arithmetic on
void pointers and assignment to rvalues. This would be a *good* thing -
with dozens of authors each with some (possibly convoluted) programming
style, C++ can only help.
HUGE drawback: C++ just doesn't work well for shared libraries, without
an AWFUL lot of care taken. Each time a new member was added to a Gtk
widget (which happens all the time) ALL Gtk programs would have to be
recompiled. As I said there are ways around this, but it requires a lot
more dicipline than (my opinion) the typical hack-and-slash widget
writer affords.
However, C++ toolkits with stable designs such as ViewKit which simply
wrap "C"-based toolkits (like Motif/Xt) work very well. C++ Gtk users
may want to visit Gtk-- which at first glance SEEMS to be a fairly
well-thought-out C++ wrapper for Gtk.
Cheers!
--
Paul T. Miller | paul@elastic.avid.com
Principal Engineer | Opinions expressed here are my own.
Avid Technology, Inc. - Graphics and Effects Software Group
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]