Expanding CTFE code during compilation
Steven Schveighoffer
schveiguy at gmail.com
Wed Jul 20 00:57:47 UTC 2022
On 7/19/22 8:33 PM, Azi Hassan wrote:
>
> Nice, a compile time console.log. Thanks a lot, this will come in handy.
> I wonder if it can be combined with version(debug) to only run the
> pragma line if compiled with -g, this way we can keep the printEnum!
> line as it is. Then again, the code would become polluted by debugging
> logic
Yep:
```d
debug template printEnum(...) {
... // everything we already did
}
else
enum printEnum(alias x) = x;
```
There's a slight bloat in the compiler symbol table when but other than
that it should be effective.
-Steve
More information about the Digitalmars-d-learn
mailing list