3

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.

he_the_great
  • 6,554
  • 2
  • 30
  • 28
deltaluca
  • 1,652
  • 2
  • 10
  • 9
  • Are you having trouble compiling the GDC compiler, or having trouble compiling your code using GDC? Also, what are the issues specifically? – Peter Alexander Oct 19 '12 at 20:21
  • Grabbing gdc from ubuntu repository only gave me an old version of GDC. Instead i'm using the one from debian/squeeze which requires gdc-4.3 >= 1:1.060-4.3.5-1. So I tried to get gdc-4.3 from debian/squeeze too, however this requires g++-4.3 >= 4.3.5-1. So I grabbed g++-4.3 from debian/squeeze, but this requires libstdc++6-4.3-dev. So I grab that from debian/squeeze, except that this requires g++-4.3.... cyclic dependency. yay. Annoyingly I do actually have gcc4.6.1 compiled from source which I use for other tasks. – deltaluca Oct 19 '12 at 20:38

1 Answers1

5

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.

Peter Alexander
  • 53,344
  • 14
  • 119
  • 168
  • 2
    This is my first foray into D, I'm considering using it for a project in the next few months in favour of C++ as I've been meaning to try D for a long time so I don't imagine I'll be using any inline assembler or intrinsics. – deltaluca Oct 19 '12 at 20:46
  • 1
    There is also a version skew between the compilers: the most current version of gdc or ldc may not always have the latest features from dmd. – BCS Oct 22 '12 at 16:09