On Thursday, 12 December 2013 at 09:01:17 UTC, Paulo Pinto wrote:
On Thursday, 12 December 2013 at 02:12:00 UTC, ed wrote:
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

Currently I always advocate that C and C++ development should
always be done with warnings as errors enabled, coupled with
static analyzers at very least during CI builds, breaking them if
anything is found.

Nice story though, thanks for sharing.

--
Paulo

I agree 100% and do so with my real D code also.

While it was a fun experiment I really don't believe think this workflow could ever replace good static analysis tools.

Cheers,
Ed

Reply via email to