Where can I find a reference for compiler flags?

Marco de Wild mdwild at sogyo.nl
Sun Jun 9 21:03:54 UTC 2019


On Sunday, 9 June 2019 at 19:12:32 UTC, Mike Brockus wrote:
> On Wednesday, 5 June 2019 at 09:45:53 UTC, Jacob Carlborg wrote:
>> On 2019-06-05 03:19, Mike Brockus wrote:
>>
>>> Where can I find a reference for compiler flags?
>>
>> Here's the reference [1]. You can also run "dmd --help" to 
>> print out the available flags. [1] might not be up to date.
>>
>> [1] https://dlang.org/dmd-windows.html
>
> This bit of information was helpful.  But do you know what this 
> is -dip- followed by some number...  I seen three of them in 
> Mir Algorithm meson build.

A DIP is a D improvement proposal. It is basically a request for 
a change of the language. Some of these can be implemented in one 
go, as they don't have any breaking changes. However, some DIPs 
break an unknown amount of code. To allow for a smooth 
transition, the new features are implemented, and are opt-in. 
Users can then gradually get their code base to compile with the 
new behaviour.

The DIP flags indicate that the compiler will build your code 
with said improvement enabled. The three DIPs you are talking 
about are

* dip25 which implements 
https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md
   This is about sealed references. If I understand correctly, 
switching this flag requires that you annotate a ref function 
parameter with return if you want to return it from the function.

* dip1000 which implements 
https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md
   This implements more scope checking for pointers. It hands a 
few extra safety checks for when pointers may last longer than 
the data they actually point to.

* dip1008 which implements 
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md
   This allows users to throw exceptions in @nogc code.

For completeness, they correspond to the current "-preview=dipX" 
compiler flag. They have been grouped together under the 
"preview" option because they were cluttering the interface. In 
fact, I gathered the information in this post by running 
"-preview=?", listing all features here. Also, at some time in 
the future, a preview will become the default behaviour.


More information about the Digitalmars-d-learn mailing list