bearophile wrote:
Walter Bright:
I'd rephrase that as D supports many different styles. One of those styles
is as a "better C".<
D can replace many but not all usages of C; think about programming an
Arduino (http://en.wikipedia.org/wiki/Arduino ) with a dmd compiler of today.
The Arduino is an 8 bit machine. D is designed for 32 bit and up machines.
Full C++ won't even work on a 16 bit machine, either.
I agree on those points. Those features would not be used when using D as a
"better C".<
A problem is that some of those D features can worsen a kernel code. So for
example you have to review code to avoid operator overloading usage :-) There
is lot of D compiler complexity useless for that kind of code. A simpler
compiler means less bugs and less D manual to read.
If you're a kernel dev, the language features should not be a problem for you.
BTW, you listed nested functions as disqualifying a language from being a kernel
dev language, yet gcc supports nested functions as an extension.
The answer is that C++ doesn't offer much over C that does not involve
those trouble causing features. D, on the other hand, offers substantial
and valuable features not available in C or C++ that can be highly useful
for kernel dev. Read on.<
I don't know if D offers enough of what a kernel developer needs.
It offers more than what C does, so it must be enough since C is enough.
Since it has more than C does, and C is used for kernel dev, then it must
be enough.<
Kernel C code uses several GCC extensions to the C language.
As I pointed out, D implements the bulk of those extensions as a standard part
of D.
With all due respect to Linus, in 30 years of professionally writing
software, I've found that if you solely base improvements on what customers
ask for, all you have are incremental improvements. No quantum leaps, no
paradigm shifts, no game changers.<
You are right in general, but I don't know how much you are right regarding
Linus. Linus desires some higher level features but maybe he doesn't exactly
know what he desires :-)
Linus may very well be an expert on various languages and their tradeoffs, but
maybe not. As far as languages go, he may only be an expert on C. All I know for
sure is he is an expert on C and kernel development, and a gifted manager.
4.3 Labels as Values: that's computed gotos, they can be useful if you write
an interpreter or you implement some kind of state machine.
They are useful in some circumstances, but are hardly necessary.