On Sunday, 4 August 2019 at 18:22:30 UTC, matheus wrote:
On Sunday, 4 August 2019 at 18:15:30 UTC, Max Haughton wrote:
What do you want to do? If you just want to count to 255 then
use a foreach
This was just an example, what I'd like in this code is either:
Get an error (exception) when overflow or even an warning (Only
if "some" flag was active).
If you want to prevent overflow you must either use BigInt or
wrap ubyte in a struct that doesn't allow overflow
Could you please elaborate about this struct wrapping? Do you
mean manually check on change?
Std.experimental.checkedint maybe exactly what you are looking for