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

Re: OT: Why is C so popular?



Alex Malinovich <demonbane@the-love-shack.net> writes:

> C is easily the dominant language for most things Linux. So therein
> lies the question. Why, exactly, is C so popular? Especially in
> comparison to C++. 

The free software culture started much before Linux.  Much free
software was written to run on many different Unix systems.
Historically, a C compiler was available on all of them.  Even after
vendors started dropping C compilers, they often included an old
K&R-style C compiler which was enough to bootstrap GCC.  The C ABI was
very stable, and you didn't need to recompile everything all the time.
It wasn't too bad getting shared libraries to work on most platforms.

In contrast, C++ was not available on most Unices with the base
system.  When it was purchased as an upgrade, it turned out that
different vendors C++ compilers were often buggy and incompatible in
many ways.  Sure, you could require that everyone install GCC, but
that was plagued with its own set of problems.  In the end, you were
stuck using a much decreased subset of C++ for very little benefit.

Then C++ was plagued with a very long standardization process where
the language changed greatly and compiler vendors had to play catchup.
It's only just getting to the point where compilers fairly faithfully
implement the language, and are reasonably compatible, nine years
after I first saw C++.  And on linux, you still have binary
compatibility issues (look at how you have to use a different JVM
under Mozilla depending on what compiler it was compiled with).

As a consequence of this, very little free software was written with
C++.  It just wasn't worth the minimal gains you might get for the
headaches it caused.  Groff was the only app I can think of that
historically used C++, and ISTR it had problems along the line.

This is slowly changing, as we have Mozilla, OpenOffice.org, and KDE,
but you asked for the history....

-- 
Alan Shutko <ats@acm.org> - I am the rocks.



Reply to: