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

[dcl.array] Padding before/after sequence of array subobjects #568

Closed
FrankHB opened this issue Nov 20, 2015 · 2 comments
Closed

[dcl.array] Padding before/after sequence of array subobjects #568

FrankHB opened this issue Nov 20, 2015 · 2 comments

Comments

@FrankHB
Copy link
Contributor

FrankHB commented Nov 20, 2015

WG21/N4567
[dcl.array]/1

An object of array type contains a contiguously allocated non-empty set of N subobjects of type T.

By reading the specification, it is not clear that whether an array object is allowed to have padding bytes (memory not overlapped with array elements) in the front or at the end. I also failed to figure it out by finding the rules directly concerned with objects and object types elsewhere. Eventually I believe it is not true because [expr.sizeof]/2 tells me:

When applied to an array, the result is the total number of bytes in the array. This implies that the size of an array of n elements is n times the size of an element.

However, this is too subtle.

In contrast, wording in ISO C seems better in this sense:

WG14/N1570
6.2.5

— An array type describes a contiguously allocated nonempty set of objects with a
particular member object type, called the element type.

So can the wording in C++ standard be improved to make the intent more explicit?

@jensmaurer
Copy link
Member

Are you only concerned about the padding before/after the subobjects? Why do you think the C wording helps to answer that question?

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Jul 15, 2017
@jensmaurer jensmaurer changed the title Wording of array type [dcl.array] Padding before/after sequence of array subobjects Feb 18, 2018
@jensmaurer
Copy link
Member

CWG in Jacksonville: NAD.

@jensmaurer jensmaurer removed the cwg Issue must be reviewed by CWG. label Mar 15, 2018
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

No branches or pull requests

2 participants