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

Does the rule of "corresponding bit" need clarification? #5063

Closed
SainoNamkho opened this issue Oct 22, 2021 · 2 comments
Closed

Does the rule of "corresponding bit" need clarification? #5063

SainoNamkho opened this issue Oct 22, 2021 · 2 comments

Comments

@SainoNamkho
Copy link

SainoNamkho commented Oct 22, 2021

[bit.cast] says

Each bit of the value representation of the result is equal to the corresponding bit in the object representation of from

But the definition of correspond is not made, allowing arbitrary order of bits seen as "corresponding". The only position that possibly implies an restriction on the order of corresponding bits is https://eel.is/c++draft/basic.fundamental#3, but only appertains to integer types.

@jwakely
Copy link
Member

jwakely commented Oct 23, 2021

[basic.fundamental] p3 doesn't define "corresponding bit" either, it also just uses it. And that seems fine to me, this is normal English usage of the word. Since there is nothing to suggest otherwise, it seems obvious to me that the first bit in the value representation corresponds to the first bit in the object representation, and the second bit in the value rep corresponds to the second bit in the object rep etc.

For example, Merriam-Webster gives this as a definition of corresponding: "having or participating in the same relationship (such as kind, degree, position, correspondence, or function) especially with regard to the same or like wholes (such as geometric figures or sets)" (emphasis mine). We are talking about an ordered set of bits here, and the correspondence is the position in that ordered set.

Assuming that some other correspondence (reverse order, or arbitrary order) when there is nothing to suggest it seems like a particularly hostile interpretation.

@jensmaurer
Copy link
Member

I agree with @jwakely here; "corresponding" seems clear enough. (There are other uses of "corresponding" in the standard that are also based on the plain English meaning of the word.)

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

3 participants