Portability of uint over/underflow behavior

bearophile bearophileHUGS at lycos.com
Mon Jan 5 00:49:35 PST 2009


Don:
> The question was about incrementing uint, not int. Preventing wraparound 
> on uints would break everything!

If optional runtime overflow controls are added to integral values, then they are performed on ubyte/ushort/uint/ulong/ucent too, because leaving a hole in that safety net is very bad and useless.
In modules where you need wraparounds, you can tell the compiler to disable such controls (recently I have suggested a syntax that works locally: safe(...) {...}, but Walter seems to prefer a module-level syntax for this).

Bye,
bearophile



More information about the Digitalmars-d mailing list