checkedint call removal

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 28 06:31:50 PDT 2014


"Ola Fosheim Grøstad" " wrote in message 
news:vqlvigvgcplkuohudsju at forum.dlang.org...

> Please guys, you should not change code-gen based on asserts. They are not 
> proofs, they are candidates for formal verification of correctness. They 
> are in essence embedded break-point checks. If you allow asserts to affect 
> codegen then it becomes a very unsafe feature. It's like having a 
> undetected bug in a unit-test introduce bugs in the released program. 8-I

The compiler is allowed to not check assertions in release mode.  This is 
because a program that would fail an assertion is a broken program, and by 
specifying -release you are telling the compiler to assume all assertions 
pass.  I don't see any reason the compiler shouldn't be allowed to change 
code-gen based on asserts.

One murky area is that assert(0) is currently used to mean both 
'unreachable' and 'unimplemented'.  It's unclear what the compiler is 
allowed to do with an assert(0) in release mode. 



More information about the Digitalmars-d mailing list