Inherent code performance advantages of D over C?
ed
sillymongrel at gmail.com
Wed Dec 11 18:11:50 PST 2013
On Wednesday, 11 December 2013 at 03:33:47 UTC, Walter Bright
wrote:
[snip]
>>> The issue is convenience of writing C code in D vs C.
>>
>> So you're trying to say that it's easier to write C code in D,
>> rather
>> than in C?
>>
>> I thought this thread was about the inherent advantages of D
>> over C.
>
> I was referring specifically to Dicebot's post as ancestor:
>
[snip]
I am finding C is much easier and more pleasant to write with DMD.
At work we're forced, under duress, to write C. I just got a new
project with a loose deadline so I thought I'd do a crazy
experiment to make it interesting...
(NOTE: I say "under duress" but I secretly like C/C++, especially
C++11/14.)
I'm writing my C code with DMD. When tested and tweaked I do a
final compile with C compiler (test once more) then commit for
our QA to pick up. Occasionally I'll compile with the C compiler
to ensure I haven't leaked any D into the code and to minimise
the #include fixups at the end.
Currently this is about 20 C-(D) files with approx. 12,000-15,000
LOC. I doubt this workflow would scale much further, although it
doesn't look like becoming an issue yet.
My experiment is a success IMO. My C code is much cleaner, safer
and more maintainable because of it. Yes, I know I could write C
like this without DMD ... but I'm lazy and fall back into bad C
habits :-)
I now advocate that students should be taught C programming with
the DMD compiler :D
Cheers,
Ed
More information about the Digitalmars-d
mailing list