Query for -dip1000

Jonathan M Davis newsgroup.d at jmdavisprog.com
Mon Feb 11 09:29:13 UTC 2019


On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via Digitalmars-d-
learn wrote:
> Is there a way to query if the -dip1000 flag has been passed to
> the compiler? I need it for enabling certain DIP-1000 escape
> analysis tests only when -dip1000 has been passed.
>
> For instance
>
>      static assert(!__traits(compiles, {
>                  char[] f()
>                  {
>                      char[2] x;
>                      return x[].splitterASCII!(_ => _ == '
> ').front;
>                  }
>              }));
>
> at
>
> https://github.com/nordlow/phobos-next/blob/bd2fe42978aab2313977042c858d77
> c5766538e8/src/splitter_ex.d#L110
>
> Or do I have to write a trait myself?

A quick grep of Phobos shows a version(DIP1000) block in std/typecons.d,
which appears to be used to make it so that a particular unittest block is
only compiled in when -dip1000 is used,  so it looks like there's a version
identifier for it.

- Jonathan M Davis






More information about the Digitalmars-d-learn mailing list