http://d.puremagic.com/issues/show_bug.cgi?id=1977





------- Comment #14 from [EMAIL PROTECTED]  2008-11-24 14:47 -------
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #10)
> > > c += 'A' - 'a';
> > > 
> > > Casting seems too strict a requirement in these types of situations.  I 
> > > can't
> > > imagine that anyone has a positive experience with these warnings, most 
> > > are
> > > just going to grumble, then insert the cast without thinking about it.
> > 
> > Notice that in the particular example you mention, the code does go through
> > because it uses +=.
> 
> Wow, that surprises me.
> 
> c = c + c should be equivalent to c += c;
> 
> So right there, either both should be invalid, or neither should.  Both have 
> an
> equal chance of overflow.

It shouldn't be that surprising, particularly considering that Java and C# obey
the same rules. The correct equivalence is that c = c + c is really c =
cast(typeof(c))(c + c).

> In fact, using obj2asm, I found that both are essentially equivalent.

That's irrelevant. Operational semantics are different from typechecking.


-- 

Reply via email to