Error on negating unsigned types
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 12 16:59:45 PDT 2017
On 7/11/2017 12:46 PM, Johan Engelen wrote:
> So, adding the error may be nice, but it would make generic code a little more
> verbose.
The particular issue you were having appears to be a bug in the compiler (I
already filed it as a bug report). Being a bug, we need more evidence that
adding an error for -u is compelling.
There really isn't a comprehensive solution for mistakes using unsigned. Some
languages deal with the issue by not having an unsigned type at all (Java). At
some level, it's necessary to just be aware of different integer sizes, integral
promotion rules, what happens with overflows, and sign.
More information about the Digitalmars-d
mailing list