Error on negating unsigned types

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 11 14:44:18 PDT 2017


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


More information about the Digitalmars-d mailing list