ImportC now supports function-like macros

Walter Bright newshound2 at digitalmars.com
Tue Feb 20 02:07:45 UTC 2024


#importc now successfully converts function-like C macros to #dlang function 
templates:

```C
#define ADD(a, b) a + b
```

is converted to a D function template:

```D
auto ADD(T1, T2)(T1 a, T2 b) { return a + b; }
```

which opens up a lot more automatic support for C macro use.

https://github.com/dlang/dmd/pull/16199

Thanks to @ibuclaw, @dkorpel, @thewilsonator, @Herringway, @ntrel, @tim-dlang 
for helping me get it over the finish line.


More information about the Digitalmars-d mailing list