Hacker News new | past | comments | ask | show | jobs | submit login

The point was probably that it is not obscure; it's what you had to learn when using plain C in the first week.



calling a[5] isn't obscure, but 5[a] sure is!


And the next week, and six months after that, again.


While it's definitely a rarely-used feature, the equivalence a[b] == *(a + b) == b[a] is fundamental to pointer math. Once you grok pointer math, then this is an interesting bit of syntax trivia and should not be forgotten easily.


Except you didn't have to learn it as part of learning C, you didn't have to learn C to learn C++, and I would bet 99% of C and C++ programmers have no idea that 5[p] is valid code.




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

Search: