Hacker News new | ask | show | jobs
by pyre 5420 days ago
I think that it's general knowledge that a[x] is a + (x * sizeof a). The idea that a[x] could be reversed to x[a] is probably not common knowledge though. I don't necessarily think that a[x] = x[a] would be "C 101." I've certainly never come across any C code that uses this property and I can't really think think of any good uses for this property that don't end up ruining the readability of the code. And in general, it seems a rather useless property that, as others have stated, is just a side-effect.

I could just as easily claim that HN has 'degenerated' if someone posts a Stack Overflow post about what the /o flag does on Perl regexes. Or maybe there will be a Stack Overflow post about how substr('abc', 1, 1) == substr('abc', 0, 1) in Oracle because it helpfully translates the 0 index to a 1 index. I mean, it's right here in the Oracle docs[1]:

  When position is 0 (zero), then it is treated as 1.
It's Oracle 101!

[1] http://download.oracle.com/docs/cd/B28359_01/olap.111/b28126...