I think 1 based arrays are useful because you can use unsigned integer types to index them, and use 0 to indicate a void index... with 0 based arrays you need signed types, then values lower than -1 are wasted.
I think 1 based arrays are useful because you can use unsigned integer types to index them, and use 0 to indicate a void index... with 0 based arrays you need signed types, then values lower than -1 are wasted.
Thats a very good point. However the counter-balance to that is that when using the index in some calculations, you'll often have to do more work to make it work with a 1-based index. And it doesn't generally look as clean or flow well either.
Bookmarks