timotheecour / D_vs_nim

comparison of D vs nim
Apache License 2.0
62 stars 14 forks source link

Update README.md #1

Closed 9898287 closed 6 years ago

timotheecour commented 6 years ago

thanks!

[D] FFI Works in CTFE

how so? IIRC can't use functions without source code in CTFE in D (such as printf etc)

9898287 commented 6 years ago

stdc is built into the D standard library, printf works fine.

timotheecour commented 6 years ago

D: dmd -o- main.d

void main(){
  import core.stdc.stdio;
  enum s=printf("hello\n");
}

Error: printf cannot be interpreted at compile time, because it has no available source code

/cc @9898287 happy to merge once you address that point

9898287 commented 6 years ago

Ah, I see what you mean.

timotheecour commented 6 years ago

merged but fixed that comment i mentioned in https://github.com/timotheecour/D_vs_nim/commit/3ee5760c1f3011287fd7ac75b5489e014fc2bbd6 ; thanks!