Which D Compiler to Use?
Asked Answered
D

2

16

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.

Deathbed answered 16/8, 2013 at 22:6 Comment(2)
See also Choosing Between GDC and DMDPicasso
See also DMD vs. GDC vs. LDCEnthusiastic
S
23

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.

Smriti answered 16/8, 2013 at 22:32 Comment(0)
E
10

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

Enthusiastic answered 19/8, 2013 at 5:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.