[Gambas-user] Possible error when doing math on bytes
Jussi Lahtinen
jussi.lahtinen at gmail.com
Tue Jan 3 23:51:16 CET 2023
Why do you use bytes in that code? You cannot trust in that approach anyway.
Jussi
On Wed, Jan 4, 2023 at 12:48 AM Brian G <brian at westwoodsvcs.com> wrote:
> A lot of my applications no longer run,
>
> And bad new, it reports error even if fast unsafe in my apps
>
> How do i just turn this off permanently, It is very bad news!
>
>
> "Failure is the key to success;
> each mistake teaches us something" .. Morihei Ueshiba
> Brian G
>
> ----- On Jan 3, 2023, at 2:40 PM, Benoit Minisini
> benoit.minisini at gambas-basic.org wrote:
>
> > Le 03/01/2023 à 23:08, Brian G a écrit :
> >> When I do math on bytes I get an overflow now when the value of the
> >> byte goes negative
> >> example:
> >> dim a as byte = 0
> >> dim b as byte = 24
> >> dim result as byte = a - b
> >>
> >> This causes an overflow error, where in the past it was just a negative
> >> number.
> >> Is this a bug or a new undocumented feature?
> >>
> >
> > Overflows were ignored before, as it is usually the case in C programs,
> > even if the behaviour of overflows is unspecified. It's for speed
> > reasons, or to make hacking easier, I dunno.
> >
> > So I decided to detect them, for a small performance penalty.
> >
> > The overflow checks are only disabled on 'Fast Unsafe' functions.
> >
> > Regards,
> >
> > --
> > Benoît Minisini.
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230104/32a80668/attachment.htm>
More information about the User
mailing list