checkedint call removal
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 30 11:18:41 PDT 2014
"Ary Borenszweig" wrote in message news:lrbbtl$778$1 at digitalmars.com...
> If assume stays in release mode then that's the difference. The problem
> then is that assert doesn't stay in release mode so the compiler can't
> make any assumption about the code that follows the "assert" because
> asserts are removed in release mode.
assume never creates a runtime check, assert does in non-release mode.
assert's condition can't be 'assumed' in non-release mode, or the compiler
could simply assume the check passed an non emit it.
> In my opinion, removing asserts in release-mode is the big problem here.
> How expensive can an assert be? Do you really want to debug that? Wouldn't
> it be better to get an exception?
That's the whole point of assert+release. If you always want an exception,
simply use enforce.
> If the compiler *never* removes asserts, then assert and assume have the
> same meaning.
No, because assert puts in a runtime check in non-release.
Hopefully my table helps. I'm not sure which assert I'm talking about half
the time.
More information about the Digitalmars-d
mailing list