Newbie questions. Which Compiler to start with? Real Time behaviour? Has anyone converted CImg yet?

bearophile bearophileHUGS at lycos.com
Sun Sep 1 17:32:50 PDT 2013


John Carter:

> We work in the embedded linux real time area,

I think you could use D for embedded area, but I think of D more 
like a low level application language.


> 1) Which D compiler should we start with?

dmd is more updated and it's the reference one, it compiles fast, 
but it produces less optimized binaries. All D compilers have 
some advantages and disadvantages. Also take in account the ldc2 
compiler.


> (We would be cross compiling to sparc or arm)

I don't know about Sparc, but arm is being worked on gdc, but I 
don't expect the libraries to work well.


> 2) The traditional argument against garbage collected languages 
> in real time environments is that they sporadically lock up 
> while collecting resulting in missed real time deadlines. 
> Certainly the "state of the art" in GC has moved beyond this, 
> and also there are workarounds for the problem. Is it possible 
> to do real time programming in D?

It's like real time programming in Java or C# (or in C++ game 
engines): you have to not allocate in the real-time parts of the 
code. Heap allocations in geeral, and GC allocations in 
particular are not yet designed for realtime work.


> 3) A good starter project for me would be to take a well known 
> cpu-intensive C++ template rich project and convert it to D and 
> then present that side-by-side to my colleagues.

To do that you have to learn D first, learn the D idioms, and 
then write the translation. It will take some time. Do you 
already have an idea for what code to translate?


> I like playing around with CImg, http://cimg.sourceforge.net/

I have used CImg in past, and it's a cute huge header. I like it 
for its lack of dependences. Importing a header is (or was) 
enough.


> CImg it is one huge template with chunks of macro magic to do 
> image processing.

I didn't know it uses significant macros. Could you show some of 
such code pieces?


> Before I start, has anyone converted CImg to DImg yet?

I think no one has converted CImg to D. There is a graphics 
project for D, perhaps named simplegraphics, that contains about 
0.01% of CImg.

I don't know but perhaps the conversion CImg to D could take a 
year or two of work for a person that knows D :-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list