ddmdgdc

Should I ensure my code compiles with both DMD and GDC?


I guess partially equivalent question: Should code that compiles with DMD, automatically compile in all circumstances with GDC?

I ask because I'm having issues getting a modern version of GDC installed from ubuntu 10.4 (seemingly cyclic dependencies, sigh) reposetory.


Solution

  • Should I ensure my code compiles with both DMD and GDC?

    Depends if you plan on compiling code on both those compilers. If you only intend to compile with DMD then there's no need to make sure your code compiles on GDC. That said, it's usually a good idea to write code that is portable across compilers just in case you do need to use GDC one day.

    Should code that compiles with DMD, automatically compile in all circumstances with GDC?

    Mostly, but there are, and always will be small differences between compilers.

    GDC and DMD (and LDC) all share the same compiler front end, so for the most part they will be feature equivalent. The differences usually come in when you start to touch lower-level stuff e.g. inline assembler, SIMD intrinsics.