3 ms·
I wonder how many of the "off by one" issues/bugs we encounter in the wild are because of arrays typically using 0-based indexing vs 1-based indexing.
by CaptainOfCoit 1y ago
I wonder how many of the "off by one" issues/bugs we encounter in the wild are because of arrays typically using 0-based indexing vs 1-based indexing.
- zabzonk 1y agoNone, in my experience. 1-based is far, far likely to introduce errors, as you have to keep adjusting the index to the algorithm and/or what is actually going on underneath.
- CaptainOfCoit 1y ago> as you have to keep adjusting the index to the algorithm and/or what is actually going on underneath. Yeah, that's mixing both of them. Wouldn't it work as well if they all used 1-based indexing or 0-based indexing? Sounds like the issue was that algorithms/stuff underneath wasn't 1-based.