> On Sep 15, 2023, at 8:41 AM, Arsen Arsenović <ar...@aarsen.me> wrote:
> 
> 
> Qing Zhao <qing.z...@oracle.com> writes:
> 
>> Even though unsigned integer overflow is well defined, it might be
>> unintentional, shall we warn user about this?
> 
> This would be better addressed by providing operators or functions that
> do overflow checking in the language, so that they can be explicitly
> used where overflow is unexpected.

Yes, that will be very helpful to prevent unexpected overflow in the program in 
general.
However, this will mainly benefit new codes. 

For the existing C codes, especially large applications, we still need to 
identify all the places 
Where the overflow is unexpected, and fix them. 

One good example is linux kernel. 

>  One could easily imagine a scenario
> where overflow is not expected in some region of code but is in the
> larger application.

Yes, that’s exactly the same situation Linux kernel faces now, the unexpected 
Overflow and 
expected wrap-around are mixed together inside one module. 
It’s hard to detect the unexpected overflow under such situation based on the 
current GCC. 

Thanks.

Qing
> -- 
> Arsen Arsenović

Reply via email to