checkedint call removal
Tofu Ninja via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 30 08:32:30 PDT 2014
On Wednesday, 30 July 2014 at 14:55:48 UTC, Tofu Ninja wrote:
> On Wednesday, 30 July 2014 at 14:51:34 UTC, Andrei Alexandrescu
> wrote:
>> Also, it's unclear to me what the optimizer would be supposed
>> to do if an assumption turns out to be false.
>
> Bad... bad... things...
That is the main argument(not saying I support it) for separating
assert and assume, assert acts like assume in -release, and if an
assume is false then bad things can happen.
Question?
If an if condition throws or returns in its body is it ok for the
optimizer to 'assume' that the condition is false after and make
optimizations for it? If so then every one complaining that
assert gets removed in -release should really just be using
enforce.
after all en enforce is simply
if(!(cond)) // can be removed if cond is provably true, same as
assert could be removed
throw ...;
// Can safely assume cond is true from this point on up until the
first catch...
The possibility for the optimizer to make the same optimizations
for assert can be done for enforce, the only difference is that
it does not get removed in -release....
More information about the Digitalmars-d
mailing list