Get compile time string of dmd command line options "-os" & "-target"

An Pham home at home.com
Thu Aug 1 04:00:08 UTC 2024


pragma(msg, os.stringof...?);
pragma(msg, target.stringof...?);

what is use case for this? mixin & import

     Long list of version.....
     version(Windows)
         mixin(import("foo_windows.enum."));
     else version(AArch64)
         mixin(import("foo_aarch64.enum"));
     else
         static assert(0);

Shorter with one line
mixin(import("foo_" ~ os.stringof ~ ".enum."));
mixin(import("foo_" ~ target.stringof ~ ".enum."));


More information about the Digitalmars-d-learn mailing list