disabling unary "-" for unsigned types

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Feb 16 11:20:21 PST 2010


On 02/16/2010 12:36 PM, bearophile wrote:
> Ellery Newcomer:
>
>> OT: has anyone written a wrapper for int/long/etc that throws exceptions
>> on overflow/underflow? Maybe such a thing should exist in the standard
>> library?
>
> No, that idea is trash. Think about arrays, do you want to litter your code with a different type of array that test the index bounds? Surely not. You want the built-in arrays to test the bounds (with eventually a compilation option to disable such tests), as in D. The same is true for integral numbers, as done in Delphi/C#.

Sure, I'd sooner have it built in to the compiler. Is it? A quick peek 
in your dlibs suggests it wasn't when you wrote powMod



More information about the Digitalmars-d mailing list