bearophile can say "i told you so" (re uint->int implicit conv)

bearophile bearophileHUGS at lycos.com
Tue Apr 2 03:18:45 PDT 2013


Don:

> But very often, people use 'uint' when they really want an int, 
> whose sign bit is zero.

Sometimes you need the modular nature of unsigned values, and 
some other times you just need an integer that according to the 
logic of the program never gets negative and you want the full 
range of a word, not throwing away one bit, but you don't want it 
to wrap-around. In programs I'd like to use:

1) integers of various sizes (with error if you try to go outside 
their range);
2) subranges of 1 (with error if you try to go outside their 
range);
3) unsigned integers of various sizes (with error if you try to 
go outside their range);
4) subranges of 3 (with error if you try to go outside their 
range);
5) unsigned integers with wrap-around;
6) multi precision integer;

Bye,
bearophile


More information about the Digitalmars-d mailing list