dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Macro function

Open Emmankoko opened this issue 1 month ago • 3 comments

Emmankoko avatar Nov 25 '25 10:11 Emmankoko

Thanks for your pull request and interest in making D better, @Emmankoko! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#22144"

dlang-bot avatar Nov 25 '25 10:11 dlang-bot

A description of what this does would be helpful.

WalterBright avatar Dec 08 '25 08:12 WalterBright

A description of what this does would be helpful.

I am actually trying to resolve #define variable some_function where the macro holds the return value of the function. I try to create a variable with the function call as an initializer in D. auto variale = some_function(x,y);

but for now, it is being blocked by Phobos zlib #define __STDC__ 1#defines(1): Error: zlibVersion cannot be interpreted at compile time, because it has no available source code

this in zlib.h

#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */


                        /* basic functions */

ZEXTERN const char * ZEXPORT zlibVersion(void);

but the implementation of zlibVersion is in zlib.c so ctfe picks the declaration in the header and does not see a function body. I am actually thinking of how to handle that.

Emmankoko avatar Dec 08 '25 09:12 Emmankoko