macros in importC
Paul Backus
snarwin at gmail.com
Thu Dec 11 15:57:56 UTC 2025
On Thursday, 11 December 2025 at 10:27:12 UTC, Emmanuel wrote:
> maybe a real example in zlib, C programmers are found to write
> code like
>
> ```
> #define zlibversion zlibVersion()
> ```
In D, a function call with no arguments can be [written without
the parentheses][1], so you could translate this to D like this:
```d
alias zlibversion = zlibVersion;
```
And usage would looks like this:
```d
if (zlibversion == whatever)
// do something
```
[1]: https://dlang.org/spec/function.html#optional-parenthesis
More information about the Digitalmars-d
mailing list