79324691

Date: 2025-01-02 18:56:02
Score: 1
Natty:
Report link

Rvalue: refers to a value that can be assigned to a modifiable left value and is not itself an lvalue.

Is this true or false? I feel like there's something wrong with that sentence.

The idea conveyed by the English sentence presented is accurate, though the wording is awkward. However, you seem to have taken the incorrect idea from it that only rvalues can appear as the right-hand operand of an assignment operation. Perhaps you're ignoring the "and is not itself an lvalue" part? That's by far the more important criterion.

    int c = a;      ?   a is rvalue  
    /*
      a is an rvalue, isn't that inconsistent with what we said before and not an lvalue itself? I hadn't noticed this basic problem

before. I wish someone could help me. Ask sb. to do STH. */

a is an lvalue because it designates an object. Objects have associated storage. It is not an rvalue, because, as your definition specifically says, lvalues are not rvalues.


Although the terms "lvalue" and "rvalue" are derived from the idea of what kinds of expressions can appear on the left and right sides of an assignment, that really doesn't get to the core idea:

Any expression of suitable data type may appear as the right-hand operand of an assignment. That doesn't speak to whether the expression is an lvalue or an rvalue.

Reasons:
  • Blacklisted phrase (1): help me
  • RegEx Blacklisted phrase (3): someone could help me
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • High reputation (-2):
Posted by: John Bollinger