Sujet : Re: do { quit; } else { }
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 13. Apr 2025, 22:58:11
Autres entêtes
Organisation : None to speak of
Message-ID : <87lds3g1vw.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
Kaz Kylheku <
643-408-1753@kylheku.com> writes:
On 2025-04-13, Michael S <already5chosen@yahoo.com> wrote:
The funny thing is that in original C prefix form of [] indexing was
equivalent to the postfix form. May be, it still is in C23, I didn't
try to look in the docs or test.
>
Are you thinking of a[i] being *(a + i) being i[a] due to commutativity?
>
That's really not a useful feature. Actually right down to a + i being
commutative when a is a pointer. It would be fine if only the
<pointer> + <integer> combination were allowed.
Agreed. The feature goes back to B, which was largely untyped, and
there wasn't a strong distinction between integers and pointers. An
expression like 5[6] would refer to a memory location, and depending
on the system it might even work.
The transition from B to C was an opportunity to restrict the ordering
of the operands, but it wasn't taken.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */