"Ola Fosheim Grøstad" " wrote in message
news:vqlvigvgcplkuohud...@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.