Liste des Groupes | Revenir à cl c |
James Kuyper <jameskuyper@alumni.caltech.edu> writes:On 4/13/25 17:30, Michael S wrote:
...My impression rfrom old books was that indexing as [i]arr was (is ?)
>also legal.>
If it had ever been legal, I would have expected it to be mentioned in
K&R 1st edition, in the section where it describes obsolete syntax that
used to be valid. It isn't.
It isn't mentioned there because the syntax isn't obsolete.
>
It's mentioned in K&R1 Appendix A section 14.3, page 210:
>
By definition, the subscript operator [] is interpreted in such a
way that E1 [E2] is identical to *((E1)+(E2)). Because of the
conversion rules which apply to +, if E1 is an array and E2 an
integer, then E1 [E2] refers to the E2-th member of E1. Therefore,
despite its asymmetric appearance, subscripting is a commutative
operation.
>
This is still true in all editions up to and including C23.
Les messages affichés proviennent d'usenet.