Messages in this thread |  | | Date | Thu, 28 Sep 2000 01:45:40 +0200 (CEST) | From | Igmar Palsenberg <> | Subject | Re: Linux kernel modules development in C++ |
| |
> Well, people said the same thing to me when I started writing OS/2 drivers in > C++. Nowadays, it's very common for non-*nix operating systems, especially > Windows.
You call windows an OS ?? I call it a bunch of function calls with way to many arguments written by a bunch of ***** that like to nag people instead of making an OS stable.
> The real advantage comes when you're writing a driver where the design is > inherently object-oriented. I can't give an example in Linux, because I've > only been writing Linux drivers for 6 months, but in OS/2, there are tons of > places where a little OO lovin' goes a long way. My initial use was in > multimedia drivers. In OS/2, the adio drivers need to keep track of multiple > "streams" of audio data. OS/2's advanced multimedia subsystem lets multiple > applications open audio streams simultaneously, and the driver has to keep > track of them. If it has the hardware, it can play the streams simultaneously. > Otherwise, it has to manage stopping one stream to play the other.
Agree, OO could make life easier.
Some arguments why not to use it in the kernel :
- C++ gives overhead. With something like a kernel that's unwanted. - Things like exception handling is hard to do in a kernel. - The're a lot more people that know C than C++
And I probably forgot a few :)
> I've oversimplified it, but that's the general idea. > > This design is inherently object-oriented. The old C code for audio drivers > was horribly convoluted. When I rewrote it in C++, there was less code, it was > easier to maintain, and ther resulting binary was actually smaller and faster! > And that's all because the language fit the design better.
Igmar
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |