[linux-elitists] Nobody's favorite language? C++ and free software
Mon Mar 31 09:25:11 PST 2003
On Wed, 2003-03-26 at 19:22, Ben Woodard wrote:
> This is exactly what scares me about C and why I prefer C++. It is not
> that you can't do these things in C it is when people do these things in
> C it starts getting messy and hard to understand and it is difficult to
> bug and often times just a bit buggy. Plus everybody does it just a
> little differently.
> I think that the biggest argument for C++ vs. C is that people try to do
> things that are native to C++ in C and it leads to inelegance.
In C it leads to things like GObject, which IMHO is the heart of
elegance. Check out GLib/GObject 2.0 (no, you don't have to care about
Gtk+ or GNOME, it's just a C library). GObject's own propaganda is at:
And of course, you can check out GLib itself at:
This basically gives you the rudiments of a high-level language (much as
C++'s STL does) in C. The verbosity often scares people off, but if you
start using it, I doubt you'll want to go back.
For starters, there's the run-time type checking that you can use for
debugging and then TURN OFF in production code. Big win for debugging
Then there's the data-structures. Everyone carries around, or uses some
pet allocator, linked list handler, hash builder, queue manager, etc in
C. GLib combines all of these into one clean library
also gives you exception handling, an event loop, threading (using your
system's pthreads, for example) and the requisite thread-safety of the
rest of the library relative to GLib's threading model, etc. On top of
*that* GObject provides further building of generic object
data-structures (ala STL, but in C) including GTypePlugin (dynamically
loadable types), closures (closures in C... the mind reals) and more.
Ok, that's my marketing spout. Dunno why I'm so passionate about GLib
(GNOME's tools and coding conventions in general, actually).
More information about the linux-elitists