Sujet : Re: Regarding assignment to struct
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 08. May 2025, 05:17:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <861psz3fea.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Nick Bowler <
nbowler@draconx.ca> writes:
On Tue, 06 May 2025 13:21:38 -0700, Keith Thompson wrote:
>
Nick Bowler <nbowler@draconx.ca> writes:
>
The rule about conversions from arrays to pointers is different
in C99 (n1124 6.3.2.1, third paragraph) compared to C89. In
particular, "an lvalue that has type ``array of type'' ..." was
changed to "an expression that has type ``array of type'' ...".
>
[...]
>
The change from "lvalue" to "expression" was made in C99. I
wonder why that was done.
>
It's not mentioned in the rationale, so we can only guess. [...]
To me it seems obvious. The change in C99 was meant to allow
access to an array inside a non-lvalue struct. When C99 was
done the committee didn't realize all the ramifications of
accessing non-value structs (which apparently has problems
even for scalar members, not just array members). Later, when
they did realize the resulting problems, they fixed things up
in C11.
See also n1253.htm, by Clark Nelson.