[Gambas-user] Should Gambas detect integer overflow?

Benoit Minisini benoit.minisini at gambas-basic.org
Sun Dec 4 20:33:35 CET 2022

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?

Benoît Minisini.

More information about the User mailing list