Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With 1-based indexing, you can't index the last element of an array that occupies the entire domain of the index type.


So? With 0-based indexing, the length of an array falls outside the domain of the index type.

The number of times either of these properties has mattered for me also cannot be represented in the domain of 1-based indexes.


You can't represent the length of that same array in the domain, which is normally enough to make this scenario unusable.


Not always, I've used bytes to store indexes to arrays of 256 elements. The length doesn't have to be the same narrow type as the indexes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: