简体   繁体   English

我应该确保我的代码与DMD和GDC一起编译吗?

[英]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? 我想部分等价的问题:编译的代码是否应该与DMD一起编译,在GDC的所有情况下自动编译?

I ask because I'm having issues getting a modern version of GDC installed from ubuntu 10.4 (seemingly cyclic dependencies, sigh) reposetory. 我问,因为我在从ubuntu 10.4(看似循环的依赖,叹息)转发中安装现代版本的GDC时遇到了问题。

Should I ensure my code compiles with both DMD and GDC? 我应该确保我的代码与DMD和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. 如果您只打算使用DMD进行编译,则无需确保您的代码在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. 也就是说,编写可以跨编译器移植的代码通常是个好主意,以防万一你需要使用GDC。

Should code that compiles with DMD, automatically compile in all circumstances with GDC? 应该用DMD编译的代码,在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. GDC和DMD(和LDC)都共享相同的编译器前端,因此在大多数情况下它们将具有相同的功能。 The differences usually come in when you start to touch lower-level stuff eg inline assembler, SIMD intrinsics. 当您开始接触较低级别的东西时,通常会出现差异,例如内联汇编程序,SIMD内在函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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