disabling unary "-" for unsigned types

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Feb 16 06:17:32 PST 2010


On 02/15/2010 09:15 PM, Steven Schveighoffer wrote:
>
> For example, there is no possible way a person unfamiliar with computers
> (and most programmers who have not run into this) would believe that
>
> b = 5;
> a = -b;
>

Tell any math major that fixnum arithmetic is really just arithmetic 
modulo 2^32 and they would believe you, even if they had never heard of 
computers

> would result in a being some large positive number. It's just totally
> unexpected, and totally avoidable.
>
> -Steve





More information about the Digitalmars-d mailing list