Compile time definitions
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 5 15:08:51 PDT 2014
Brenton:
> How would you recommend I do something like this with D?
In D compile-time constants are introduced using the "enum"
keyword.
You can also use the "-version=..." compiler switch to compile
your D code according to some version, that can be a number or
identifier.
In D there isn't the "-D" switch of gcc, so you can do something
similar putting your string into a little textual file, and
importing it inside the module using
mixin(import("myfilename.txt")) statement plus the -Imypathname
compiler switch.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list