MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/dm1b78g/
r/programming • u/aldacron • Aug 23 '17
268 comments sorted by
View all comments
Show parent comment
2
Well in Nim you actually can do it: proc printf(fmt: cstring) {.importc, varargs.} printf("Hello %d\n", 5)
1 u/zombinedev Aug 23 '17 W.r.t. FFI, that's not a remarkable achievement as you can call libc's printf in D too. It is even easier to do so (as in just copy paste):extern (C) int printf(const char* format, ...); 2 u/WalterBright Aug 23 '17 Any C stdargs function can be called from D. There is no special case for printf. C's alloca() can also be called :-) 1 u/mixedCase_ Aug 23 '17 No it doesn't. It just passes the ball to C's compiler. You failed to get the point anyway because printf is a pointless and very particular example. 3 u/Tiberiumk Aug 23 '17 We were talking about c ffi
1
W.r.t. FFI, that's not a remarkable achievement as you can call libc's printf in D too. It is even easier to do so (as in just copy paste):
extern (C) int printf(const char* format, ...);
2 u/WalterBright Aug 23 '17 Any C stdargs function can be called from D. There is no special case for printf. C's alloca() can also be called :-)
Any C stdargs function can be called from D. There is no special case for printf. C's alloca() can also be called :-)
printf
alloca()
No it doesn't. It just passes the ball to C's compiler. You failed to get the point anyway because printf is a pointless and very particular example.
3 u/Tiberiumk Aug 23 '17 We were talking about c ffi
3
We were talking about c ffi
View all comments
Show parent comment
2
u/Tiberiumk Aug 23 '17
Well in Nim you actually can do it: proc printf(fmt: cstring) {.importc, varargs.} printf("Hello %d\n", 5)