[Issue 1977] Relax warnings for implicit narrowing conversions caused by promotions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 25 07:17:18 PST 2008


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





------- Comment #19 from andrei at metalanguage.com  2008-11-25 09:17 -------
(In reply to comment #18)
> > A better problem to spend energy on is the signed <-> unsigned morass. We've
> > discussed that many times and could not come up with a reasonable solution. For
> > now, D has borrowed the C rule "if any operand is unsigned then the result is
> > unsigned" leading to the occasional puzzling results known from C and C++.
> > Eliminating those fringe cases without losing compatibility with C and C++ is a
> > tough challenge.
> 
> Indeed.  Without promoting to a larger type, I think you are forced to take
> this course of action.  When adding an int to a uint, who wants it to wrap
> around to a negative value?  I can't think of a better solution.
> 

You just did in fact. Your idea with defining some internal types is very
similar to one of the promising solutions we've been exploring for resolving
signedness of arithmetic operations.

I will in fact stop here and paste the rest of my message to the main newsgroup
because it's of general interest and segues away from this bug report.


-- 



More information about the Digitalmars-d-bugs mailing list