Conditional compilation: Which version identifier for release code ? version(assert) ?

wjoe invalid at example.com
Fri Aug 6 09:33:57 UTC 2021


On Thursday, 5 August 2021 at 11:01:56 UTC, Adam D Ruppe wrote:
> On Thursday, 5 August 2021 at 09:18:08 UTC, wjoe wrote:
>> If it's to be determined whether or not the code is being 
>> compiled in debug or release mode, i.e. e.g. the dmd 
>> ```-release```
>
> You should never use the -release flag. It should be renamed to 
> "-enable-security-holes" since that's what it actually does.
>

This is good advice. Actually I had no intention to *use* the 
```-release``` option.
My question was aimed at getting an understanding of the 
different version identifiers and how they are affected by the 
command line options in order to be able to pick one that 
reflects the users expectations.
My wording should have been better. Sorry for the confusion.

> Instead you can disable specific things as-needed, but.... it 
> is probably never needed. These are also never supposed to 
> actually change the behavior of your program, but in reality, 
> like I said they do tend to change it - by enabling security 
> holes.

However isn't the point of using version identifiers and these 
options to actually change the behavior of the program ?
I mean if bounds checking is enabled I expect the program to 
behave differently, i.e. to abort if something is out of bounds.



More information about the Digitalmars-d-learn mailing list