Error on negating unsigned types

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 11 15:08:21 PDT 2017


Walter Bright wrote:

> On 7/11/2017 12:46 PM, Johan Engelen wrote:
>> uint total = 0;
>> void add(int x) { total += x; }
>> ubyte popCount() { return 5; }
>> add(popCount());
>> add(-popCount());
>> writeln(total); // <-- what does this print? (behavior is different from 
>> C)
>
> The behavior should be the same.
>
> https://issues.dlang.org/show_bug.cgi?id=17637

so, you want to change promotion rules? just to clarify the things, how 
*exactly* you want new rules to work, and what will happen with `byte a; a 
= -a;`, and why?


More information about the Digitalmars-d mailing list