Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarifying "the value of the expression" in simple assignment expression #1966

Merged
merged 1 commit into from Apr 2, 2018

Conversation

eus
Copy link
Contributor

@eus eus commented Mar 21, 2018

To quote [expr.ass]p2,

In simple assignment (=), the value of the expression replaces that of the
object referred to by the left operand.

End quote.

I think "the value of the expression" means the right operand of a simple
assignment, not the whole simple assignment expression, because [expr.ass]p2
describes the semantics of a simple assignment and because of the following
that I quote from Footnote 64 in 6.3.2.1/1 of WG14 N1570, the latest publicly
available draft of the C11 standard accessible at
http://open-std.org/jtc1/sc22/wg14/www/standards:

The name ‘‘lvalue’’ comes originally from the assignment expression E1 =
E2, [...] What is sometimes called ‘‘rvalue’’ is in this International
Standard described as the ‘‘value of an expression’’.

End quote.

Since this ISO C++ draft does not have such a footnote, I propose to rewrite
[expr.ass]p2 as given in this commit. Richard Smith has reviewed my proposal
and made my original rewrite more precise at https://goo.gl/tvD8Pu.

    In simple assignment (=), the value of the expression replaces that of the
    object referred to by the left operand.

End quote.

I think "the value of the expression" means the right operand of a simple
assignment, not the whole simple assignment expression, because [expr.ass]p2
describes the semantics of a simple assignment and because of the following
that I quote from Footnote 64 in 6.3.2.1/1 of WG14 N1570, the latest publicly
available draft of the C11 standard accessible at
http://open-std.org/jtc1/sc22/wg14/www/standards:

    The name ‘‘lvalue’’ comes originally from the assignment expression E1 =
    E2, [...] What is sometimes called ‘‘rvalue’’ is in this International
    Standard described as the ‘‘value of an expression’’.

End quote.

Since this ISO C++ draft does not have such a footnote, I propose to rewrite
[expr.ass]p2 as given in this commit.  Richard Smith has reviewed my proposal
and made my original rewrite more precise at https://goo.gl/tvD8Pu.
@cpplearner
Copy link
Contributor

See #720.

@eus
Copy link
Contributor Author

eus commented Mar 22, 2018

Good that the issue was brought up about two years ago. So, I think I will notify @zygoloid who suggested me to open this editorial issue in the first place.

@eus
Copy link
Contributor Author

eus commented Mar 22, 2018

I have notified @zygoloid at https://goo.gl/nVUVRc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants