Страница 1 из 1

C++ sucks???

Добавлено: 31 окт 2004, 00:23
Hermit
вот, прочитал и задумался...
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++."
Оригинал Здесь

Добавлено: 31 окт 2004, 00:42
Pasha
Of course it does. What is the point of using C++ in kernel when the code has been successfully being written in plain C. There will be no less bugs if you use C++.

1. AFAIK, most of Windows applications is written in C++. :)
2. Does anyone actually know what the Windows kernel is written in?

Добавлено: 31 окт 2004, 18:44
Llama
Pasha, на сях в винде ядро, и ассемблере местами наверное. И win32 api не объектный ИМХО. На ++ еще никто рабочего ядра не написал AFAIK, разве что BeOS, и то не уверен.

Добавлено: 31 окт 2004, 20:00
Pasha
Понятно