On Thursday, 5 December 2013 at 18:26:48 UTC, Jonathan M Davis
wrote:
On Thursday, December 05, 2013 19:16:29 Maxim Fomin wrote:
On Thursday, 5 December 2013 at 17:15:39 UTC, Steve Teale
wrote:
> Is this unavoidable, or could the compiler safely make the
> conversion implicitly?
It is example of notorious phenomemena called "integer
promotions" and "usual arithmetic conversions". It is
unavoidable
given Walter's decision to keep this C stuff in D.
To be fair, you can't solve the problem automatically. It's
fundamentally
wrong to compare signed and unsigned values, and doing either
the conversion
to unsigned or to signed could be wrong (or both could be
wrong), depending on
the values. The best that could be done would be to warn about
the comparison
or to make it an error.
http://d.puremagic.com/issues/show_bug.cgi?id=259
- Jonathan M Davis
Warning would be an option, but AFAIK Walter does not like
warnings, so it is unlikely to be implemented.