[Gambas-user] Should Gambas detect integer overflow?

BB adamnt42 at gmail.com
Mon Dec 5 09:29:26 CET 2022


I think it should raise an error. Out of curiosity, is it a flag? (To 
save me the effort as I presume you already know) If so then if a coder 
is "relying" on integer overflow tricks then they should be clever 
enough to disable the flag - if they really want to.

b

On 5/12/22 6:03 am, Benoit Minisini wrote:
> Hi again,
>
> The 'gcc' compiler allows Gambas to detect integer overflows when 
> doing integer arithmetic with a very light penalty.
>
> Alas the other compiler, 'clang', does not support that.
>
> But I guess 'clang' will certainly gain a similar feature in the 
> future, if 'gcc' has it.
>
> So, I wonder if Gambas should raise an error if an integer overflow is 
> detected (when doing an integer +, - or *)?
>
> Note that the change is not backward compatible for program that 
> explicitly rely on the undefined behaviour of overflow arithmetic in 
> C. Which is not a good idea anyway...
>
> What do you think?
>


More information about the User mailing list