Question

I would like to try out D but I'm not quite sure what compiler to use for it. I have found some articles, and also SO questions, on the topic, but I did not find any up-to-date ones.

What are the benefits of each compiler, and what are the drawbacks? Right now the DMD compiler seems the best to me but I might just be misled by outdated information.

Was it helpful?

Solution

All 3 of the main D compilers (dmd, gdc, ldc) use the same front-end, but dmd is generally a bit ahead of the others as it's the reference compiler. Also, I believe that there are a few cases where the other 2 don't implement some features yet (primarily on Windows or OS X IIRC), though in general, they work just fine. The primary advantage to gdc or ldc is that they generate faster code (though how much faster depends on the code). However, they also take much longer to compile code.

So, if you're just starting out, I'd suggest that you just use dmd and not worry about it. It's guaranteed to be the most up-to-date compiler, and I believe that it's what most people use. The primary downside to it is that the code that it generates isn't quite as fast, but you can look into the other compilers later if/when you really care about that.

For production code, the approach that I would generally take would be to develop using dmd and then generate the production code with either gdc or ldc. That way, you get the fast compilation times when developing code but still get the faster binaries in production.

OTHER TIPS

Adding to Jonathan's answer:

Your choice is also constrained by OS you are using. On Linux, all 3 (DMD, GDC and LDC) are available. On Windows, DMD is your only practical choice, especially if you are used to Visual Studio (get Visual D add-on). Using GDC or LDC on Windows involves varying degrees of pain (see this discussion).

If you want to play with SIMD, use DMD. Other compilers have incomplete or missing implementations (based on DConf 2013 talks).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top