4 ms·
D supports function pointers and array pointers, and always has.
by WalterBright 3y ago
D supports function pointers and array pointers, and always has.
- bryanlarsen 3y agoBut not in a C-compatible way, right? IIRC, you can't just take a good size C file, put a tiny bit of D in it and compile it with the D compiler, can you? Happy to be corrected.
- destructionator 3y agoTranslating small syntax differences like that are easy to do by machine if you have to.
- WalterBright 3y agoYes, it's semantically C-compatible. They're close enough that converting C code to D code manually is straightforward. But it isn't necessary to do that, you can simply import C code into D code: // D code import mycstuff; // loads mycstuff.c int main() { int* p = mycfunction(); // call C function return *(p + 1); // pointer arithmetic }