-
Notifications
You must be signed in to change notification settings - Fork 751
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] Make the storage in the example for storage providing properly aligned #6422
Conversation
Something like this has come up recently. |
I'm not opposed to |
So this kind of example only needs an "assumes |
Or equivalently, |
Well, examples would require |
So adding +#include <cstdint>
+static_assert(sizeof(std::int32_t) == 4); and changing the integer type keywords to the appropriate +// Assume the abstract machine described in \ref{that.first.example}. for the rest of the examples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good, minimal fix to me.
Note [basic.align] p1:
|
This is OK. Assuming that |
However, there is no wording in the current standard that says the value of |
This is not possible, because in such an implementation, if you have |
Fixes cplusplus/CWG#379.
The example seemingly assumes that the implementation-defined properties on common platforms (e.g.,
sizeof(int)
is4
) hold. I guess we can keep such assumptions implicit and avoid pedantically writingsizeof(int)
.