assert semantic change proposal

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 08:14:14 PDT 2014


On Wednesday, 6 August 2014 at 15:02:10 UTC, Matthias Bentrup 
wrote:
> So I take the compiler is allowed to throw away code without 
> any asserts already ?

Yes it can, but only in the cases where it can prove it is the 
same.

The main difference is that assume does not need to be proved, it 
is stated to always be true so no proof needed. Some have said 
that the compiler can still try to prove what it can and issue 
warnings if it is provable untrue, but it would actually be a 
little silly on the part of the compiler to waist it's time 
trying to disprove things it "knows" are true. If it "knows" it 
is true then why even bother checking?


More information about the Digitalmars-d mailing list