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

[intro.object]/1 Turn non-normative wording into a Note; remove incorrect wording. #4490

Merged
merged 1 commit into from Apr 16, 2021

Conversation

languagelawyer
Copy link
Contributor

The last sentence looks just wrong: the type of the expression doesn't affect the value of the objects.
The second to last sentence doesn't look normative, it looks like a typical implementation strategy description.

Fixes #2308

@jensmaurer
Copy link
Member

I think our current object model in C++ is that each object has a type; if the expression used to access the object doesn't fit, it's undefined behavior (except for the aliasing exceptions). I agree the note appears to say something else.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 10, 2021
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Apr 16, 2021
@tkoeppe tkoeppe merged commit 34d0392 into cplusplus:master Apr 16, 2021
@jensmaurer
Copy link
Member

Editorial meeting 2021-04-16: Looks good.

@kitsnet
Copy link

kitsnet commented Apr 19, 2021

I think our current object model in C++ is that each object has a type; if the expression used to access the object doesn't fit, it's undefined behavior (except for the aliasing exceptions). I agree the note appears to say something else.

How does this change address the aliasing exceptions?
Doesn't it break them?

@jensmaurer
Copy link
Member

How so? Please look at the actual change.

@kitsnet
Copy link

kitsnet commented Apr 19, 2021

@jensmaurer
Copy link
Member

This change has removed the confusing (and incorrect) wording

"For other objects, the interpretation of the values found therein is determined by the type of the \grammarterm{expression}{s}\iref{expr.compound} used to access them."

This (also given the StackOverflow discussion) appears to be a net improvement.

@kitsnet
Copy link

kitsnet commented Apr 19, 2021

OK, I see that the wording of [expr.reinterpret.cast] that caused the StackOverflow discussion has also changed since then, so I remove my objection.

@languagelawyer
Copy link
Contributor Author

The wording has been changed to take into account pointer-interconvertibility. For non-pointer-interconvertible objects (as in the SO question), the new wording has the same meaning as the old wording.

@kitsnet
Copy link

kitsnet commented Apr 19, 2021

That might have been the intent. However, it also moved some otherwise objectionable wording from the normative part into a note and arguably reduced its scope.

Otherwise, adding yet another case to the use of the language that is formally UB but practically IDB is hardly an improvement.

@xmh0511
Copy link
Contributor

xmh0511 commented Apr 20, 2021

I wonder, if P1839 would be approved, Is that something is necessary to be clarified by the wording that has been a note by this thread. Probably not, Maybe we can use pointer-interconvertible to interpret that. Cancel the normative for the wording can make an object always constantly; Regardless of what the type of a "glvalue" that refers to the object is, it always has the same value as if the type is the dynamic type of that object.

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