[basic.compound] p3 Improve the definition of the hypothetical array for the arithmetic purpose
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[expr.add] p4 defines the concept of pointer arithmetic evaluation
Otherwise, if P points to an array element i of an array object x with n elements...
Which requires we clearly know which element of the array P points to. However, for the pointer arithmetic and comparison purpose, the definition of an object that is not an array element is defined as what [basic.compound] p3 says
an object of type T that is not an array element is considered to belong to an array with one element of type T.
"belong to" is not clear. It is even vague which element of the array is to which a pointer that points to that object would point. Even though the meaning might be inferred from the context. I think the improvement to this definition can be
an object of type T that is not an array element is considered to be the array element 0 of an array with one element of type T.
This can clearly convey that a pointer points to an object of type T that is not an array element can be considered to point to the array element 0 of an array object x with one element of type T for both pointer arithmetic and comparison purpose.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with [basic.compound] paragraph 3 and [expr.add] paragraph 4, then review how the draft describes pointers to objects that are not array elements. Compare the proposed wording with surrounding standard terminology. Done means the definition clearly identifies the object as array element 0 for pointer arithmetic and comparison purposes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100