RE: [gtk-list] Re: Was : Why is gtk+ written in C? - now : Quick Rant



Small Caveat:

You said:

"Finally, the voice of reason. C++ gives one extraordinary power if one is a
competent designer, and can afford to let go of absolute efficiency. If
you're
writing a kernel, or an important library, like Gtk+, that's another matter,
but for most of app writers C++ is a boon."

Remember, though, that it's possible to write C++ code that is as efficient
as C, if you don't use things like virtual functions and exceptions.  The
Standard Template Library (STL) is a good example of a library that both
relies heavily on C++ features (templates), and is extremely efficient.

I think that the real issue is that C has been standardized for a long time,
so that if you stick to ANSI C you can be reasonably sure that most systems
will
be able to compile it, while the C++ standard has been
changing over the past few years, so that you can never
be sure that another compiler will build your code.  On GNU systems, the
problem has been even worse, because gcc for C++ really sucks.

Given this reality, I think it was a wise decision to code Gtk in C.  Now
that the ANSI standard for C++ is imminent, and as egcs gets better, I think
you will see many new projects being done in C++, including important
libraries and perhaps even the kernel.  Where efficiency is paramount,
developers will stick to the subset of C++ that is as efficient as C (which
is larger than the subset of C++ that is C).  After all, if there are
features of C++ that could help a developer organize his code, and that
don't cost anything efficiency-wise, why not use them?

Steve Molitor





-----Original Message-----
From: root@lon-p37.wwdc.com [mailto:root@lon-p37.wwdc.com]On Behalf Of
James Bailie
Sent: Thursday, October 15, 1998 12:44 AM
To: gtk-list@redhat.com
Subject: [gtk-list] Re: Was : Why is gtk+ written in C? - now : Quick
Rant


julian.gosnell@nomura.co.uk writes:

>In conclusion, ANSI C is a subset of C++. Stick to this subset and it will
>cost you no more than C itself. Take advantage of C++'s extra features
where
>appropriate and you pay a corresponding price. If you think that you can
>provide similar features in a C program for less cost than C++ can, please
>submit them to the C++ community - I'm sure they would be delighted to
>consider your optimisations.

Finally, the voice of reason. C++ gives one extraordinary power if one is a
competent designer, and can afford to let go of absolute efficiency. If
you're
writing a kernel, or an important library, like Gtk+, that's another matter,
but for most of app writers C++ is a boon.  The argument that goes, "I found
it difficult," is not a criticism of the language at all, is it?

C being the lingua franca of programming languages, a Gtk+ written in C is
the
most widely useful and most efficient way to go.

--
James Bailie

http://www.wwdc.com/~jbailie

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



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