Confusion over enforce and assert - both are compiled out in release mode

Moritz Maxeiner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 27 04:00:41 PDT 2017


On Sunday, 27 August 2017 at 10:46:53 UTC, Andrew Chapman wrote:
> On Sunday, 27 August 2017 at 10:37:50 UTC, Moritz Maxeiner 
> wrote:
>> [...]
>
> Oh interesting.  Does DUB support passing through the 
> --enable-contracts flag to ldc?

Sure, using platform specific build settings [1] such as 
`"dflags-ldc": ["--enable-contracts"]`.

> Also, if this is an ldc specific thing it's probably not a good 
> idea i'd imagine, since in the future one may want to use a 
> GDC, or DMD?

If you want to use another compiler that supports it, add the 
appropriate "dflags-COMPILER" setting to your package file.
With regards to dmd: Don't use it for release builds, use gdc or 
ldc (better optimizations).

https://code.dlang.org/package-format?lang=json#build-settings


More information about the Digitalmars-d-learn mailing list