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 : 12. Sep 2024, 20:38:11
Autres entêtes
Organisation : None to speak of
Message-ID : <87ikv0y864.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Gnus/5.13 (Gnus v5.13)
Bart <
bc@freeuk.com> writes:
[...]
It's not that complicated, not with C anyway.
>
Because in C, if you take the 3-4 categories of LHS in assignments
(ignore the esoteric ones, and [] and . are really the same), there is
only one top-level lvalue node to consider.
I agree, there's only one thing to consider. The LHS of an
assignment is a modifiable lvalue.
We've spent a lot of time arguing about how any "categories" there
are for the LHS of an assignment. If I recall correctly, the whole
thing started when you stated that "the LHS of an assignment is
one of four categories", leading to a debate about whether four
is the correct number.
Enumerating the kinds of expressions that can be modifiable
lvalues is interesting, I suppose, but are A and (A) in different
"categories"? Is it important to count generic selections and
compound literals?
Who cares, and why?
That's the only thing that needs to 'change', which I don't think is
onerous anyway.
I don't know what you're saying needs to change.
With more elaborate LHSs, for example like this:
>
(A[i], B[i], (x ? C.m : D.m) = Y();
>
There can be both multiple and nested lvalue nodes. So 'lvalueness'
has to somehow propagate down into those branches after parsing has
been done.
>
And yet, I was doing that in the 1980s on my toy compilers. So that's
not that hard either.
Ok, it's not that hard to implement things that are not valid C.
Are you suggesting that anything that's easy to implement should
be added to the language standard? It's not that simple. Most of
the time, I'm more interested in discussing what's actually in C
than what could be added. And ease of implementation is only one
thing to consider when adding a new feature, and probably not the
most important.
[...]
What exactly /is/ lvalue conversion? What is converted to what?
This is specified in the C standard (6.3.2.1p2 in C11, 6.3.3.1p2
in C23 drafts). I suggest you read it.
An lvalue (an expression that designates an object) is converted
to the value stored in the designated object. This conversion
(adjustment) does not occur on the LHS of an assignment or in
several other contexts.
It might have been clearer to say that the expression is adjusted
from an expression that designates an object (an lvalue) to an
expression that yields the value of that object (not an lvalue)
Note that this is not a run-time conversion, like a conversion of an
integer value to a floating-point value. The standard uses the word
"conversion" to refer both to run-time operations that take a value
of one type and yield a value of another type, and to compile-time
adjustments that change the way an expression is handled.
Array-to-pointer conversion is another example of the latter.
[...]
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */