[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux kernel modules development in C++
** Reply to message from on Wed, 27 Sep 2000 16:15:31

> But where's the advantage in using C++? Plain old C has served admirably in
> UNIX and Linux development since the very beginning. What more can C++ offer
> for driver development that outweighs the reduced accessibility of the code to
> those of us who are more proficient 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

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.

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.

Timur Tabi -
Interactive Silicon -

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.187 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site