On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote:
[...]
If version(X) is not defined, there should be no call and no extra code at -O0.
[...]

In C, you could do something like:
```
#if X
  void foo() {......}
#else
  #define foo()
#endif
```

How would you do this in D?

By requiring the compiler to inline the empty foo:

This won't work. Semantically, there is still a call and e.g. profiling will see it:
https://godbolt.org/g/AUCeuu

-Johan



Reply via email to