On Friday, 29 March 2013 at 19:29:21 UTC, Jonathan M Davis wrote:
No. -w makes it so that warnings are errors, so you generally can't make anything a warning unless you're willing for it to be treated as an error at least some of the time (and a lot of people compile with -w), and this sort of thing is _supposed_ to work without a warning - primarily because if it doesn't, you're forced to cast all over the place when you're dealing with both signed and unsigned types, and the casts actually make your code more error-prone, because you could end up casting something other than uint to int or int to uint by accident (e.g. long to uint) and end up with bugs due to
that.
This reason alone ain't good enough to justify the implicit cast
from unsigned to signed and vice-versa. When I sum 2 short values
I am forced to manually cast the result to short if I want to
assign it to a short variable. Isn't that prone to errors, too?
Yet the compiler forces me to cast. I really think we should
eliminate this discrepancy.

Reply via email to