Reference (section label): [dcl.array]
Discussion (Mattermost): https://chat.isocpp.org/general/pl/3gzbcx4fy3dgjpyno7hkejuksa
Issue description
[dcl.array] p6 states:
An object of type “array of N U” consists of a contiguously allocated non-empty set of N subobjects of type U, known as the elements of the array, and numbered 0 to N-1.
It is not sufficiently clear what "numbered 0 to N-1" means. [basic.compound] Note 5 states that an array has the same address as its first element, relying on this sentence, but it's not clear from normative wording that the first element is found at offset 0 and the last element is found at offset N-1.
In general, "numbered" doesn't strictly imply an ordering from first to last, "to be numbered" has no defined meaning, and the use of "set" instead of "sequence" implies that no particular order is enforced.
Suggested resolution
Update [dcl.array] p6 as follows:
An object
+a
of type “array of N U” consists of a contiguously allocated non-empty
-set
+sequence
of N subobjects of type U, known as the elements of the array
-, and numbered 0 to N-1.
+. The elements of the array, from first to last,
+may be accessed using the expressions a[0] through a[N-1] ([expr.sub]).
Reference (section label): [dcl.array]
Discussion (Mattermost): https://chat.isocpp.org/general/pl/3gzbcx4fy3dgjpyno7hkejuksa
Issue description
[dcl.array] p6 states:
It is not sufficiently clear what "numbered
0toN-1" means. [basic.compound] Note 5 states that an array has the same address as its first element, relying on this sentence, but it's not clear from normative wording that the first element is found at offset0and the last element is found at offsetN-1.In general, "numbered" doesn't strictly imply an ordering from first to last, "to be numbered" has no defined meaning, and the use of "set" instead of "sequence" implies that no particular order is enforced.
Suggested resolution
Update [dcl.array] p6 as follows: