assert(0) behavior

via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 3 19:36:58 PDT 2015


On Monday, 3 August 2015 at 15:18:12 UTC, Dicebot wrote:
> On Monday, 3 August 2015 at 14:34:52 UTC, Steven Schveighoffer 
> wrote:
>> Why do we do this?
>
> Because all asserts must be completely removed in -release
>
> Yet assert(0) effectively mean "unreachable code" (it is 
> actually defined that way in spec) and thus it is possible to 
> ensure extra "free" bit of safety by crashing the app.

It isn't free. The point of having unreachable as primitive is 
that you can remove all branching that leads to it.


More information about the Digitalmars-d mailing list