On Tuesday, 26 February 2013 at 16:15:49 UTC, bearophile wrote:
Craig Dillabaugh:

I am a novice D programmer and use C++ in my work. One thing I
find myself doing when I need to implement some non-trivial
algorithm is that I will originally code it in D and perform
testing from there to make sure I have the logic right.
Once I have everything working in D I simply port it over to C++.

I often write the code in D (sometimes I start from Python and then I convert it to D), get it right, write down more tests, then I slowly lower the level of the D code keeping it correct with help of the tests, and then convert it to C.

When the code is quite complex, if I do this I waste some time, but it's a known amount of time, while if I follow a more direct route, writing the C code directly, I can't tell how much debugging time I will need.

Bye,
bearophile

One of the reasons I like D for this kind of work is that as a
multi-paradigm language it lets you do stuff in a style closer
what your final C++ code
will look like. My research is in satellite image processing, so
most of
my work involves reading in imagery into 2D arrays and performing
processing
over all/or part of an image. I find being able to write code
like:

for(int i =0; i < rows; i++) {
   for(int j = 0; j < cols; j++) {

   }
}

Sometimes is the easiest way to perform certain tasks.  D lets
you do this and the syntax is exactly the same a C/C++ - Python?
I don't know - but I imagine it would be tricker to port to C++!
I have found, at least in this particular problem domain, that
the C++/D style syntax is about as good as it gets.

Reply via email to