View mode: basic / threaded / horizontal-split · Log in · Help
July 14, 2011
About using C++ for kernel drivers
An article about the problems in using C++ to write Windows drivers, "C++ for Kernel Mode Drivers: Pros and Cons" (February 2007):
http://msdn.microsoft.com/en-us/windows/hardware/gg487420.aspx

The article shows why C++ is not so fit for this purpose. Is D even worse for this purpose? If this is true then is it possible to improve D a bit for such low level purposes? How? Even if it is possible to improve D to such purposes, is it worth it? Such purposes after all are quite a niche, most programmers don't need to write kernel mode drivers and similar things. Anyway, I hope someday people will design a system language better than C and very fit for such niche but important purposes too :-)

Bye,
bearophile
July 15, 2011
Re: About using C++ for kernel drivers
At least MacOS X drivers are developed in a subset of C++
http://developer.apple.com/library/mac/#documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Introduction/Introduction.html#//apple_ref/doc/uid/TP0000011-CH204-TPXREF101

Symbian is fully C++ with some assembly

So there are at least two comercial OS using C++ to write kernel drivers.

If we take Modula2+, Modula-3 and Oberon family of languages into 
consideration, there are quite a few OS using higher
level languages to write their drivers, even if the OS were mostly used 
inside research labs. I am sure there are a few
more examples available.

So I don't see an issue with D.

--
Paulo

"bearophile" <bearophileHUGS@lycos.com> wrote in message 
news:ivnt08$17og$1@digitalmars.com...
> An article about the problems in using C++ to write Windows drivers, "C++ 
> for Kernel Mode Drivers: Pros and Cons" (February 2007):
> http://msdn.microsoft.com/en-us/windows/hardware/gg487420.aspx
>
> The article shows why C++ is not so fit for this purpose. Is D even worse 
> for this purpose? If this is true then is it possible to improve D a bit 
> for such low level purposes? How? Even if it is possible to improve D to 
> such purposes, is it worth it? Such purposes after all are quite a niche, 
> most programmers don't need to write kernel mode drivers and similar 
> things. Anyway, I hope someday people will design a system language better 
> than C and very fit for such niche but important purposes too :-)
>
> Bye,
> bearophile
July 15, 2011
Re: About using C++ for kernel drivers
On 7/14/2011 4:10 PM, bearophile wrote:
> An article about the problems in using C++ to write Windows drivers, "C++ for
> Kernel Mode Drivers: Pros and Cons" (February 2007):
> http://msdn.microsoft.com/en-us/windows/hardware/gg487420.aspx
>
> The article shows why C++ is not so fit for this purpose. Is D even worse for
> this purpose? If this is true then is it possible to improve D a bit for such
> low level purposes? How? Even if it is possible to improve D to such
> purposes, is it worth it? Such purposes after all are quite a niche, most
> programmers don't need to write kernel mode drivers and similar things.
> Anyway, I hope someday people will design a system language better than C and
> very fit for such niche but important purposes too :-)


All that article says is you can't write Windows device drivers without being 
familiar with how your compiler generates code, and how device driver code 
differs from regular code, and how to adapt to those differences. This applies 
to C, C++ and D.

Writing kernel code simply isn't for people who aren't willing to do this, 
regardless of what language they use.
Top | Discussion index | About this forum | D home