Liste des Groupes | Revenir à l c |
Em 4/13/2025 6:58 PM, Keith Thompson escreveu:Kaz Kylheku <643-408-1753@kylheku.com> writes:>On 2025-04-13, Michael S <already5chosen@yahoo.com> wrote:Agreed. The feature goes back to B, which was largely untyped, andThe 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.
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.
Proposal for c2y
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3517.htm
>
" A postfix expression followed by an expression in square brackets [
] is a subscripted designation of an element of an array. The use of
this operator with the first operand of integer type **is an
obsolescent feature.**"
>
and make M[-1] a constrain
Les messages affichés proviennent d'usenet.