[Gambas-user] Possible error when doing math on bytes

Jussi Lahtinen jussi.lahtinen at gmail.com
Wed Jan 4 00:39:35 CET 2023

> for the last 5 or 6 years we could depend on this, So many of my code in
> many applications is now broken.
> like expecting adding one to 255 to wrap to zero etc...

So the problem is not the lack of negative numbers, but the need for the
That can be implemented by mod. Change the bytes to integers (and put them
as properties of classes if not already). Then use mod on the change of the

This is normal behavior for unsigned numbers.

In C and other low level languages... otherwise not really.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230104/69b0fc05/attachment.htm>

More information about the User mailing list