Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> writes:So if C was to behave the same way as BLISS:On 29/08/2024 21:30, Keith Thompson wrote:The read is done by converting the lvalue to its value, which is not anBart <bc@freeuk.com> writes:>
[...]So what exactly is different about the LHS and RHS here:The RHS is evaluated to determine the current value stored in the
>
A = A;
object
named A. The LHS is evaluated to determine the object that's designated
by the name A; its current value is irrelevant.
Sure, but the same thing happens on both sides: one ends up performing
a Read via that Lvalue, and the other does a Write via that Lvalue.
lvalue. Please read the discussion of "lvalue conversion" in the C
standard.
No, the address isn't written. The object is written.In C terms, the RHS undergoes *lvalue conversion*, where an expression>
that's an lvalue is converted to the value stored in the designated
object. The LHS does not undergo lvalue conversion.
>(In BLISS, doing the same thing requires 'A = .A' AIUI; while 'A = A'Because BLISS, unlike C, does not have implicit lvalue conversion;
is also valid, there is a hidden mismatch in indirection levels
between left and right. It is asymmetric while in C it is symmetric,
although seem to disagree on that latter point.)
the
prefix "." operator performs explicit lvalue conversion. I presume the
"." operator isn't specific to assignments.
But it must have that conversion on the LHS, otherwise it's A's
address that is written to rather than its value, which doesn't make
sense. That's why I said it was asymmetric; the RHS needs an explicit
operator, the LHS doesn't.
The RHS evaluation determines the value currently stored in the object.
The LHS evaluation does not. That's the asymmetry.
In BLISS, the evaluation of the expression A determines the object that
the name A designates. In C, it can either do that *or* it can extract
the value currently stored in that object.
Les messages affichés proviennent d'usenet.