Thread overview
[Issue 19669] There is no way for code to detect whether -dip1000 is enabled or not
Feb 11, 2019
Seb
Feb 14, 2019
ZombineDev
Mar 04, 2020
Walter Bright
February 11, 2019
https://issues.dlang.org/show_bug.cgi?id=19669

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #1 from Seb <greeenify@gmail.com> ---
For reference and completeness, here's a better example of what you can do already to detect dip1000:

```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

--
February 14, 2019
https://issues.dlang.org/show_bug.cgi?id=19669

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--- Comment #2 from ZombineDev <petar.p.kirov@gmail.com> ---
IMO, https://dlang.org/spec/traits.html#getTargetInfo should be able to give you all specified compiler flags, not just -dip1000.

--
March 04, 2020
https://issues.dlang.org/show_bug.cgi?id=19669

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|---                         |INVALID

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to ZombineDev from comment #2)
> IMO, https://dlang.org/spec/traits.html#getTargetInfo should be able to give you all specified compiler flags, not just -dip1000.

That would be an enhancement request. Seb has shown how to reliably detect if -dip1000 is thrown, so this issue is resolved.

(In general, doing things in the existing language is better than adding more
features.)

--