|
|
|
|
|
by yellowapple
504 days ago
|
|
> For example, they can't assume that. x + 1 > x for unsigned ints, but are free to assume that for standard ints. No they ain't: julia> x = typemax(Int16)
32767
julia> x + Int16(1) > x
false
Integers are integers, and can roll over regardless of whether or not they're signed. Avoiding rollover is not a reason to stick with signed integers; indeed, rollover is a very good reason to avoid using signed integers unless you're specifically prepared to handle unexpectedly-negative values. |
|