简体   繁体   中英

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.

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 eg inline assembler, SIMD intrinsics.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM