3 ms·
What kind of code would actually be affected by this change? It’s easy to imagine sensible code that depends on signed integer overflow (I’ve written some mysel
by foldr 2y ago
What kind of code would actually be affected by this change? It’s easy to imagine sensible code that depends on signed integer overflow (I’ve written some myself in languages where its behavior is well defined). But how often does one come across sensible code that depends on integer overflow for pointers?
- raverbashing 2y agoThere's a subtlety here I was first going to say that this would only apply on embedded devices or kernel code But note, the problem here is not if overflowing (pointer + offset) points to a valid address, but simply if the calculation works Though maybe you're right, I guess in modern platforms this almost always never apply and my rant is over the top
- foldr 2y agoThe calculation still works, you just can’t check if there was an overflow. I can imagine maybe doing that on, say, an embedded platform with a 16-bit address space. But this kind of code is going to be vastly less common than code that depends on signed integer overflow.