Thread overview
LKM
Dec 07, 2004
Essien Ita Essien
Dec 07, 2004
Thomas Kuehne
Dec 08, 2004
Ilya Minkov
December 07, 2004
Can i use D to write a Linux Kernel MOdule?

If yes, any ideas on how to proceed?

If not why?

I seem to understand (from what i've been seeing around), that D, is closer to C than C++ and that its closer to the machine too than C++, so i'm wondering, can D, go where no C++ has gone before?


December 07, 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Essien Ita Essien schrieb am Tue, 7 Dec 2004 04:12:46 +0100:
> Can i use D to write a Linux Kernel MOdule?
>
> If yes, any ideas on how to proceed?
>
> If not why?
>
> I seem to understand (from what i've been seeing around), that D, is closer to C than C++ and that its closer to the machine too than C++, so i'm wondering, can D, go where no C++ has gone before?

The only potential problem that spring to mind is GC.

I know too little about the memory management of LKMs to provide any decisive answer.

The next version of gdc is rumored to have a standalone GC implementation...

Thomas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.9.13 (GNU/Linux)

iD8DBQFBtaPA3w+/yD4P9tIRAscSAKDNen8I4BjaI1LUTPk5xTvERauRlQCgqiwv
XsrsA7liImVrlMsfzPtj9xs=
=6e0I
-----END PGP SIGNATURE-----
December 08, 2004
Essien Ita Essien schrieb:
> Can i use D to write a Linux Kernel MOdule?

Perhaps, but i don't think it's a good idea.

> If yes, any ideas on how to proceed?
> 
> If not why?

I just don't think it may make sense. :)

If you don't get a garbage collector working, you loose almost every other feature of D. Besides, i don't know the exact implications, but i would tend to strictly limit memory usage in a kernel unit, which pretty much rules out the usage of Phobos (the D standard library) because it uses copy-on-write convention.

> I seem to understand (from what i've been seeing around), that D, is closer to C than C++ and that its closer to the machine too than C++, so i'm wondering, can D, go where no C++ has gone before? 

C++ is an exact superset of C (minus one or two purely syntactic and not notable exceptions), and is in principle much more flexible than D. There are a few areas where D has potential to beat C++, and these would mostly lie when writing large and complex software, and lie mostly in manageability, but may also touch large-scale optimization.

If you consider usual programming style, than some areas, like array handling, are made in D more transparent and machine-near than usually done in C++ with STL. However i would hesitate to make a general conclusion from that, because there many examples to the opposite, and C++ by itself doesn't force you to use STL.

-eye