dsimcha wrote:
Is it portable to rely on unsigned integer types wrapping to their max value
when they are subtracted from too many times, i.e.

uint foo = 0;
foo--;
assert(foo == uint.max);

ulong bar = 0;
bar--;
assert(bar == ulong.max);

ubyte baz = 0;
baz--;
assert(baz == ubyte.max);

I assume that in theory this is hardware-specific behavior and not guaranteed
by the spec, but is it universal enough that it can be considered portable in
practice?

Walter's intent is to put that guarantee in the language.

Andrei

Reply via email to