Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are most of the biggest open source projects in C? [closed]

Tags:

c++

c

open-source

I'm having a debate with a friend and we're wondering why so many open source projects have decided to go with C instead of C++. Projects such as Apache, GTK, Gnome and more opted for C, but why not C++ since it's almost the same?

We're precisely looking for the reasons that would have led those projects (not only those I've listed but all C projects) to go with C instead of C++. Topics can be performance, ease of programming, debugging, testing, conception, etc.

like image 929
tomzx Avatar asked Oct 11 '09 21:10

tomzx


People also ask

Is C suitable for large projects?

C is indeed suitable for large projects. Programming in C requires a great deal of discipline than most modern programming languages.

What is the largest open source project?

Linux and open source It's also become the largest open source software project in the world. The Linux operating system was created as an alternative, free, open source version of the MINIX operating system, which was itself based on the principles and design of Unix.

Is open source better than closed source?

– Cost: Open-source software tends to be free, so it's usually the best choice for individual users. The closed source can cost more, as it has to be designed for the user's needs. – Service: Closed source software is the winner here, as there are usually dedicated service teams that can help you when things go wrong.


3 Answers

C is very portable, much more than C++ was 10 years ago.

Also, C is very entrenched in the Unix tradition. Read more in 'The Art of Unix Programming', about Unix and OO in general, and about specific languages on unix (including C and C++).

like image 191
gnud Avatar answered Oct 15 '22 22:10

gnud


There are numerous counter examples: everything based on Qt for one.

Also, on my Debian testing system:

edd@ron:~$ apt-cache rdepends libstdc++6|wc -l
4101

So that's 4101 packages depending on the basic C++ library. For comparison, I get about 14,982 for libc6 or roughly 3.6 as many. But it is not if there aren't any C++ projects in Open Source land.

Edit: Thinko on my part: as the C++ packages also depend on libc6, the ratio really is

(14982 - 4101)/4101 = 2.65

so there are roughly 2 1/2 times as many packages implemented in C than there are in C++.

like image 34
Dirk Eddelbuettel Avatar answered Oct 15 '22 22:10

Dirk Eddelbuettel


Eric Raymond's wonderful book "The Art of Unix Programming" has some reflections on this issue (the whole book is well worth reading in either the paper or free online editions, I'm just pointing to the relevant section -- Eric was involved with the coining and introduction of the term "open source", and is always well worth reading;-0).

Summarizing that section, Raymond claims that "OO languages show some tendency to suck programmers into the trap of excessive layering" and Unix programmers (and by extension open-source programmers) resist that trap of "thick glue".

Later in the book, you find some considerations specifically about C++, such as "It may be that C++'s realization of OO is particularly problem-prone". Whether you agree or not, the whole text is well worth reading (I can hardly do it justice here!-), and rich with bibliography pointing you to many other relevant studies and publications.

like image 44
Alex Martelli Avatar answered Oct 15 '22 22:10

Alex Martelli