www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - assert expression in release mode

reply drug <drug2004 bk.ru> writes:
Before I lived in assurance that asserts are actual only in debug mode 
and in release mode they are nothing (except `assert(0)`). But today my 
whole life is going sour because I stumbled upon assert in release mode 
and of course that assert is failing.

This doc https://dlang.org/spec/expression.html#assert_expressions say 
nothing about debug mode vs release mode.

So the question is when and why assert expression is enabled in release 
mode (besides assert(0))
Mar 23 2020
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On Monday, 23 March 2020 at 10:08:58 UTC, drug wrote:
 Before I lived in assurance that asserts are actual only in 
 debug mode and in release mode they are nothing (except 
 `assert(0)`). But today my whole life is going sour because I 
 stumbled upon assert in release mode and of course that assert 
 is failing.

 This doc 
 https://dlang.org/spec/expression.html#assert_expressions say 
 nothing about debug mode vs release mode.

 So the question is when and why assert expression is enabled in 
 release mode (besides assert(0))
E.g. https://dlang.org/dmd-osx.html#switch-release There are also other switches like -boundscheck and -check. It’s possible you have some library or project that is causing the behavior. -Steve
Mar 23 2020
parent drug <drug2004 bk.ru> writes:
On 3/23/20 2:14 PM, Steven Schveighoffer wrote:
 
 E.g. https://dlang.org/dmd-osx.html#switch-release
 
 There are also other switches like -boundscheck and -check. It’s 
 possible you have some library or project that is causing the behavior.
 
 -Steve
 
Thank you, Steve. In my case I guess it was my mistake because now I returned to the problem to fix it and I can not reproduce that behavior locally.
Mar 23 2020