digitalmars.D.learn - newbie question
- %u (2/2) Sep 18 2011 does D compatibility with C restrict D from evolving ?
- Timon Gehr (11/13) Sep 18 2011 Binary compatibility as in extern(C) certainly does not. As to
- bearophile (15/19) Sep 18 2011 In practice there are few differences, try to compile this in C and D, s...
does D compatibility with C restrict D from evolving ? and if D drop this will that prevent complexity?
Sep 18 2011
On 09/18/2011 10:08 PM, %u wrote:does D compatibility with C restrict D from evolving ?Binary compatibility as in extern(C) certainly does not. As to source-level compatibility, the only "guarantee" that Ds design gives is that C code will either compile as D code with identical semantics or not compile at all. The only thing that restricts a language from evolving is compatibility with the existing code base for that language.and if D drop this will that prevent complexity?You mean, "does C compatibility impose additional complexity on the D language?" ? I am sure it does not, C is quite basic. And as I said, not every C program is also valid D code. That is both an advantage and a disadvantage in comparison to C++.
Sep 18 2011
Timon Gehr:As to source-level compatibility, the only "guarantee" that Ds design gives is that C code will either compile as D code with identical semantics or not compile at all.In practice there are few differences, try to compile this in C and D, swapping the import/include: import core.stdc.stdio; //#include "stdio.h" float a[1]; void foo(float v[1]) { v[0]++; } int main() { foo(a); printf("%f\n", a[0]); return 0; } Bye, bearophile
Sep 18 2011