Liste des Groupes | Revenir à cl c |
On 2024-08-29, Ben Bacarisse <ben@bsb.me.uk> wrote:
>Bart <bc@freeuk.com> writes:>
>I think that these (with x, y having compatible scalar types):>
>
x + 1 = y;
(x + 1) = y; // in case above was parsed differently
>
are both valid syntax in C. It will fail for a different reason:
an '+' term is not a valid lvalue.
The compiler must tell you that neither is valid C. That's
because what is required on each side of assignment is not
exactly the same thing. It's a distraction to argue about why
each is not valid C as both have errors that require diagnostic
at compile time.
Bart is only saying that it's valid syntax, not that it's valid C.
>
According to the ISO C syntax (not taking into account contraints,
which are not syntax) that view is justified.
Les messages affichés proviennent d'usenet.