Hacker News new | ask | show | jobs
by hzhou321 3477 days ago
The first version always leaves a "clean" state, that is both indices points to actual array locations. A mentally "clean" state makes understanding easier. For the third version one has to keep in mind the wrap around behavior of computer specific integers throughout the comprehension process, so it is a bit more difficult (to understand).
1 comments

The third version also allows for the write index to be a counter of total store operations, at least until overflow, which could be useful.