Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Wed Dec 11 19:34:15 PST 2013


On 12/11/2013 6:11 PM, ed wrote:
> I am finding C is much easier and more pleasant to write with DMD.

I find the same thing!

> At work we're forced, under duress, to write C.

My condolences!

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

Wow. This is a pretty interesting use case.

> 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

This really is cool.

BTW, this sounds a lot like when I used to develop real mode MSDOS programs. An 
errant pointer in MSDOS would frequently crash the system and even scramble the 
hard disk. It was pretty bad. Therefore, I'd do all my development on a 
protected mode operating system (Windows NT or OS/2 16 bit), and only when it 
was bug free would I even attempt to bring it up under MSDOS. This approach 
saved me endless hours of misery.



More information about the Digitalmars-d mailing list