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

I can see how in a higher-level language it might make sense to use 1-based indices. this is, after all, how humans typically count. I just don't agree with it as a general statement over all programming languages. in low-level contexts where you are working directly with memory, it is quite natural for indices (or idx * element_size) to be equivalent to offsets.


Depending on the context of the program, both can be more comfortable. Pointers/enumerators? 0-based Heavy math problem? 1-based

I believe there is a few languages which can let you set it




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

Search: