checkedint call removal
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jul 28 08:07:07 PDT 2014
"Ola Fosheim Grøstad" " wrote in message
news:ejbwjvylulclchhehlnw at forum.dlang.org...
> No, writing wrong code is one thing.
>
> Having a single typo in a constraint-test cause memory unsafety undetected
> is a disaster. And many such typos _will_ go undetected.
Sure, because having single typos in other parts of your code causing memory
unsafety are totally not a disaster. And those never go undetected.
>
> Let's say you want to test "divisor >= 0", but end up with "divisor != 0"
> => division_by_zero failure even if the code is correct.
Let's say you want to add two numbers, but instead of writing 'a + b' you
write 'a - b'!!!! The program fails even though you totally meant to write
the correct code.
>
> Adding assert() should increase quality, not decrease it. Adding asserts
> will increase the probability of wrong constraints entering the codebase.
> That means with the regime indicated here you should write as few assert()
> statements as possible.
I disagree. If you do not want your assertion removed then don't compile
with -release.
> Where in the spec does it say that assert is a tool for specifying
> optimization constraints?
Where in the spec does it say assert is a tool for inserting breakpoints?
Asserts are a tool for conveying to the compiler certain conditions that you
expect to be true.
More information about the Digitalmars-d
mailing list