Liste des Groupes | Revenir à cl c |
On 10/09/2024 15:15, Ben Bacarisse wrote:Bart <bc@freeuk.com> writes:>
On 08/09/2024 17:44, Bart wrote:Sorry, I was busy. I see KT as given a good summary (though I was notOn 08/09/2024 16:39, Ben Bacarisse wrote:>Bart <bc@freeuk.com> writes:OK, so what are they?
>In language like C, the LHS of an assignment is one of four categories:>
>
A = Y; // name
*X = Y; // pointer
X[i] = Y; // index
X.m = Y; // member select
I can think of three others. There may be more.
TM:Yes, very good. I count four or five, depending on whatdifferences count as different.
>
I guess nobody is going to say what those extra categories are, are
they?
counting forms in parentheses).
It's bad form to call somebody out on something but then refuse to tellYou have implemented a C compiler. The wind-up I sensed was your giving
them exactly what they've got wrong or have missed out.
>
3, 4, or maybe 5 mysterious categories of LHS assignment terms that I have
never been encountered in a million lines of C code I've processed, but
nobody is willing to say what they are?
>
I sense a wind-up.
out misinformation, but I'll just have to take your word for it that
you've been arguing about assignments without know what constitutes an
lvalue expression.
But when I didn't answer soon enough, surely you could have just looked
in any good C reference to find all the expression forms that are
lvalues.
f().m where f returns a struct.>I can think of at least one expression form for X that contradicts thisExample?
claim.
Nothing here either.
f().m is allowed with mcc and tcc compilers (but it doesn't do anything
useful). It's not classed as an lvalue by gcc.
By "the LHS of an assignment", and "X is a term of any complexity" I imply
those X's forming valid LHS terms.
>
An X used as X[i]=Y, *X=Y, or X.m=Y, or even any of the Y's, could be
rejected for lots of reasons. That X isn't an array, pointer or struct for
example.
(BTW I've now counted the different categories of my own languages are
there are about 15 in all that can be used as assignment targets. A lot are
just terms that can appear as rvalues, that can also appear as lvalues.
>
For example a 'switch' statement, which standard C doesn't even allow as an
rvalue.
>
Sorry, did your remark above suggest I don't know what an lvalue is?
Maybe
it's a miracle all this stuff works then!)
Les messages affichés proviennent d'usenet.