Why are most Linux programs written in C? Why are they not written with C++, which is newer?

  • 17
    C++ is newer than C, but that's a bit irrelevant. They are different languages.
    – Mat
    Oct 30, 2011 at 18:27
  • 6
    You should probably ask this at StackOverflow or Programmers (where the topic has actually been already nicely covered). Oct 30, 2011 at 18:29
  • 4
    @Mat Well, it's not entirely correct, as C++ is a superset of C. You can program in C and compile it with a C++ compiler. It'll compile and work as expected.
    – polemon
    Oct 30, 2011 at 23:56
  • 11
    @polemon: that's incorrect, there are incompatibilities. en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
    – Mat
    Oct 31, 2011 at 5:25

3 Answers 3


There have been many discussions about this. Mainly, the reason is a philosophical one. C was invented as a simple language for system development (not so much application development). There are many arguments for using C++, but there are about as many for not using C++ and sticking to C.

In the end, it's a historical issue. Most application stuff is written in C, because most Kernel stuff is written in C. And since back then most stuff was written in C, people tend to use the original languages.

At this point, someone might ask "OK, so why is the kernel written in C and not ported to C++?". This has been discussed on kerneltrap some time ago. One nice explanation that can be quoted from this thread is a response by yoshi314 (quoting directly):

that's because nearly every c++ app needs a separate c++ standard library to operate. so they would have to port it to kernel, and expect an extra overhead everywhere.

c++ is more complex language and that means that compiler creates more complex code from it. because of that, finding that a problem stems from compiler bug,rather than code error is easier in c.

also c language is more barebone, and it's easier to follow its assembly representation, which is often easy to predict.

c++ is more versatile, but c is more suited for lowlevel or embedded stuff.

On the other hand, "most of Linux programs" is quite misleading. Take a look at graphical applications. Python is getting more and more ground especially in GUI environments on Linux. About the same thing that's happening with Windows and .NET.

  • 4
    Additionally the C have stable ABI and can be easily plugged to other languages via their native FFI while C++ does not have human-readable ABI and g++ had changes in the ABI. Therefore the libraries tended to be written in C rather then C++. Because you want to have one language in project so did the programs bundled with library. (At least that was a story with Gnome). Oct 30, 2011 at 23:33
  • @MaciejPiechotka All this is true, and it is a nice discussion, but c doesn't have a defined ABI, except that there is often a "obvious" way to work things on each platform. After that it's follow the leader. Nov 1, 2011 at 0:34
  • @dmckee: I haven't stated it has standardized but C API on each platform follows certain simple rules (including no or minimal mangling) which rarely changes - which makes it useful for the purpose even if not 100% correct. Nov 1, 2011 at 13:08
  • 2
    Nowadays, you can also consider that ... * everything you can do in C you can also do in C++ in pretty much the same way, think also "extern C" ... * the compiler won't make more complex code if you don't write more complex code ... * you can write the same barebone stuff in C++ ... * you can link and use C++ libraries from C. In the end it is a quite a historical issue.
    – Zrin
    Dec 12, 2014 at 21:04

After reading the following email from Linus Torvalds the creator of linux. I can't help thinking the answer above is incorrect. He seems to think that C++ programmers are not good systems programmers. And that the extra features in C++ often cause more problems in the long term compared to the benefits they bring in the short term. While one may disagree with him, it's difficult to overstate the influence he has had on the linux operating system.


  • Damn, that was harmful
    – AFP_555
    Oct 17, 2019 at 7:31

I think next to technical topics about C usage is decentralization of linux system, Windows i strictly centralized : AD etc. Linux is creating by many people around the world,and does not have tools like AD, ok we have got OpenLdap, but in Linux each program is running as standalone application. Ofcourse historical reason is the most important. I do not imagine who will be take care about objects application`s security if Linux will be written in Object C++.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.