You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For purposes of pointer arithmetic ([expr.add]) and comparison ([expr.rel], [expr.eq]), a pointer past the end of the last element of an array x of n elements is considered to be equivalent to a pointer to a hypothetical array element n of x and an object of type T that is not an array element is considered to belong to an array with one element of type T.
It is a bit obscure to distinct the difference between the wording "a pointer past the end of the last element " and "a pointer past the end of the first(or the other element but not the last) element", which one can be considered to have the pointer value category "a pointer past the end of an object"? Presumably, we should explicitly categorize the former case to have "a pointer past the end of an object".
a pointer to a hypothetical array element n of x is said as a pointer past the end of the object that is the element n-1 of x.
This proposal would make it be clear that only a pointer past the end of the last element of an array has that pointer value. And which object the pointer value is talking about.
Terms should be consistent:
[expr.eq#3.1]
If one pointer represents the address of a complete object, and another pointer represents the address one past the last element of a different complete object, the result of the comparison is unspecified.
Shouldn't we say that?
another pointer represents the address one past the end of a different complete object
Since the complete object belongs to an array with a single element for comparison purposes, "last element of a different complete object" sounds a bit strange.
The difference between "past the last element of an array" and "past the end of the last element of an array"
In these footnotes [expr.add#footnote-72], [expr.rel#footnote-73], we use the former, however, the normative rule in [basic.compound#3] is strictly using the latter. I think we should uniformly use the same utterance.
The text was updated successfully, but these errors were encountered:
xmh0511
changed the title
A pointer past the end of the last element should have an explicit pointer category and consistently use that term
A pointer past the end of the last element should have an explicit pointer value category and consistently use that term
Jul 28, 2021
[basic.compound#3]
It is a bit obscure to distinct the difference between the wording "a pointer past the end of the last element " and "a pointer past the end of the first(or the other element but not the last) element", which one can be considered to have the pointer value category "a pointer past the end of an object"? Presumably, we should explicitly categorize the former case to have "a pointer past the end of an object".
This proposal would make it be clear that only a pointer past the end of the last element of an array has that pointer value. And which object the pointer value is talking about.
Terms should be consistent:
[expr.eq#3.1]
Shouldn't we say that?
Since the complete object belongs to an array with a single element for comparison purposes, "last element of a different complete object" sounds a bit strange.
The difference between "past the last element of an array" and "past the end of the last element of an array"
In these footnotes [expr.add#footnote-72], [expr.rel#footnote-73], we use the former, however, the normative rule in [basic.compound#3] is strictly using the latter. I think we should uniformly use the same utterance.
The text was updated successfully, but these errors were encountered: