3 ms·
Interesting perspective. I dont have the same experience. To me a wraping 32 bit index on a 64bit machine is much more likely to seg fault if it reads 4 billio
by quelsolaar 5y ago
Interesting perspective. I dont have the same experience. To me a wraping 32 bit index on a 64bit machine is much more likely to seg fault if it reads 4 billion values forward, rather than a few bytes backwards and therefore i find unsigned index wrapps to be easier to debug. In all fairness wrapping indicies are an extremely rare bug for me, so i cant say i have much experience debugging it.
- jcelerier 5y ago> In all fairness wrapping indicies are an extremely rare bug for me, so i cant say i have much experience debugging it. Do you run your code with -fsanitize=undefined -fsanitize=integer ?
- quelsolaar 5y agoNo I do not. I run ISO conformant C without options.
- jcelerier 5y agoYou really should try it on your codebase if you have the occasion
- eterevsky 5y agoI think when you use a variable that can have values in the range of millions, it's prudent to use 64-bit types and not 32-bit unless you are very much memory-constrained. And I've never seen a 64-bit signed variable overflow.