lkml.org 
[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Linux kernel modules development in C++


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?

But then, I'm just an old reactionary who still isn't sure ANSI C was such a big
improvement over K&R...





Timur Tabi <ttabi@interactivesi.com> on 09/27/2000 03:35:19 PM

To: unlisted-recipients: ;(no To-header on input)
cc: Linux Kernel <linux-kernel@vger.kernel.org> (bcc: Wayne
Brown/Corporate/Altec)

Subject: Re: Linux kernel modules development in C++



Well, that's not much of answer. It certainly doesn't mean anything to people
who have port drivers with tens of thousands of lines of code, all in C++.

I haven't tried C++ in Linux drivers myself, but I assume it can't be any more
difficult than what I had to do for OS/2. Five years ago (imagine that - OS/2
is years ahead of Linux in this regard), I hacked up a method for getting C++
code to compile into an OS/2 device driver. I had to write some extra code,
but it was really no problem.
Sure, I couldn't use exception handlers, but so what? All I needed to do was
define malloc() and free(), and I could create and destroy objects whenever I
wanted. In fact, you don't even need malloc() and free() - the C++ language
allows you to redined new and delete on a per-class basis.

Then I created some stub functions that would normally be called under an error
condition (like a missing virtual method in a subclass). In fact, the linker
did all the work in this case - when I tried to link my driver with no runtime,
it gave me a nice list of missing functions, and all I had to do was create
stubs for them.



-
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/

\
 
 \ /
  Last update: 2005-03-22 12:38    [from the cache]
©2003-2011 Jasper Spaans