disabling unary "-" for unsigned types

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 16 06:35:02 PST 2010


On Tue, 16 Feb 2010 09:17:32 -0500, Ellery Newcomer  
<ellery-newcomer at utulsa.edu> wrote:

> 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

But you don't designate it as such.  If it was required to designate  
modulo 32 in the expression, then it would be fine with me.  I went  
through Calc V and never really had to worry about this.  Advanced  
mathematicians are not a model for the everyday programmer :)

Even if you explain it to people, they still forget!  It's the same as !=  
null was.

-Steve



More information about the Digitalmars-d mailing list