Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> writes:OK, thanks for the prompt response.On 08/09/2024 17:44, Bart wrote:The LHS of an assignment must be a modifiable lvalue. Searching for theOn 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?
word "lvalue" in the standard's section on expressions yields several
forms not listed above:
- A parenthesized lvalue:
(A) = Y;
- A generic selection whose result expression is an lvalue:
_Generic(0, int: A) = Y;
Not sure why you'd do this.
- X->m, where X is a pointer (you might think of that as the same
category as X.m, but the standard doesn't define the -> operator in
terms of the . operator)
- A compound literal:
int n;
(int){n} = 42;
This assigns a value to a temporary object which is immediately
discarded. I can't think of a valid use for this.
Les messages affichés proviennent d'usenet.