Question about ubyte x overflow, any safe way?

matheus matheus at
Sun Aug 4 18:22:30 UTC 2019

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?


More information about the Digitalmars-d-learn mailing list