Sujet : Re: Top 10 most common hard skills listed on resumes...
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 08. Sep 2024, 19:50:23
Autres entêtes
Organisation : None to speak of
Message-ID : <87zfoi2d5c.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
User-Agent : Gnus/5.13 (Gnus v5.13)
Bart <
bc@freeuk.com> writes:
[...]
Take this C:
>
int A, B;
>
A = B;
>
There are two types associated with the LHS: 'int*' which is the type
the name A (its address), and 'int' which is the type of A's value.
No, there is no int* associated with the LHS. The LHS is an lvalue
of type int.
An lvalue is an expression that (potentially) *designates* an object.
In this case, the lvalue `A` designates the int object whose name is
"A". Designating an object is not defined in terms of the object's
address or constructing a pointer to it.
Nothing in the C syntax or semantics of this assignment expression
refers to the address of A, or to anything of type int*.
(The generated code may or may not compute the address of A.)
C *could* have defined assignment and similar operations in terms of the
address of the target, and perhaps some other languages might do so.
But it doesn't.
And if it had, then assignment to bit fields would have had to be
described as a special case. They aren't. If bf is the name of a bit
field, then obj.bf is an lvalue designating a bit field object (which
has no address), and `obj.bf = 42` assigns a value to that object.
[...]
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */