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

Yeah, I don't get the love for 0 base, unless you're doing C level stuff, which is the real reason for 0 based indexing.


I guess it depends on the field you're working with. I'm definitely more at home with 0-based languages, although at this point I have worked a lot with MATLAB/Octave code as well.

In my case, it is very common that i-th element in an array is somehow related to say (x0 + i*dx). This fits naturally with 0-based indices.

With 1-based indices you tend to have (i-1) or (x0-dx) everywhere. It gets extremely annoying when people get clever and rearrange this -1 in equations. Then it is no longer clear what is there as a side effect of the indexing and what is perhaps some constant in the numerical method.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: