Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


KernelTrap: Linux: C++ In The Kernel?

Jan 22, 2004, 07:00 (33 Talkback[s])

[ Thanks to Jeremy Andrews for this link. ]

"A recent posting to the lkml requested help in porting the C++ Click Modular Router kernel module from the 2.4 stable kernel to the 2.6 stable kernel. The request was for ideas on fixing C++ related compilation errors, but the thread quickly turned into a lengthy debate on whether or not C++ had a place in the Linux kernel. The issue has been debated many times before, long ago earning its own entry in the lkml FAQ which offers numerous reasons why the kernel is not written in C++.

"During the recent discussion, when it was suggested that perhaps the kernel is written in C simply because 'we've always done it that way...,' Linux creator Linus Torvalds joined in to explain:

'In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me--writing kernel code in C++ is a BLOODY STUPID IDEA.

"'The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed: 1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels. 2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel. 3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++...'"

Complete Story

Related Stories: