On 07/29/2014 03:07 AM, Walter Bright wrote:
On 7/28/2014 1:49 PM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dl...@gmail.com>" wrote:
You might want to assert() that you have enough headroom in a statically
allocated buffer when testing. Say you assert that the buffer is never
more than
50% full for normal loads. You obviously don't want the -release build
to make
such an assumption!

You're misunderstanding

He still has a point. This is just another case of the keyword not matching the semantics very well. It would be more aptly named 'assume' instead of 'assert' (and be un-@safe if release mode is to trust it unconditionally.)

and misusing assert.

'assume' is completely redundant with 'assert'.
...

Only if you assume _a priori_ the program to be correct.

To have different debug builds, use debug statements.

'version(assert) assert' is a better match here, because if one uses 'debug assert', there is the possibility of passing both -debug and -release and get the undesired behaviour.

Reply via email to