Re:Obscure C++ Features
by Jare on Wednesday December 11, 2013 @06:14AM
(#6887023)
Most people understand that a[3] and *(a + 3) yield the same result, not that they are actually identical in terms of language syntax.
[ Parent
| on HN ]
They are trivially not identical in terms of syntax: one uses ( and the other [. Surely you mean in terms of what operation they both represent?
they really aren't identical in the general case - this is a mistake on the part of the author. trivially consider the case where i overload operator[]...
Re:Obscure C++ Features
by CJefferson on Wednesday December 11, 2013 @08:23AM
(#6887481)
Yes, this is more of an obscure C feature (they are exactly the same in all cases in C, the standard defines a[b] as *(a+b)), which is inherited by C++.