Checking if a flag was passed to the compiler
Nordlöw
per.nordlow at gmail.com
Thu Mar 22 20:10:24 UTC 2018
On Thursday, 22 March 2018 at 14:58:56 UTC, Seb wrote:
> For reference and completeness, a simple example:
>
> ```d
> void main()
> {
> enum isDIP1000 = __traits(compiles, () @safe {
> int x;
> int* p;
> p = &x;
> });
> pragma(msg, isDIP1000);
> }
> ```
>
> normal: https://run.dlang.io/is/RID7vh
> -dip1000: https://run.dlang.io/is/1yJfVQ
>
> (this could of course be fancier)
Thanks
More information about the Digitalmars-d-learn
mailing list