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

[expr.rel] Unclear how function pointers are compared #3850

Closed
brevzin opened this issue Mar 10, 2020 · 4 comments · Fixed by #4617
Closed

[expr.rel] Unclear how function pointers are compared #3850

brevzin opened this issue Mar 10, 2020 · 4 comments · Fixed by #4617
Assignees

Comments

@brevzin
Copy link
Contributor

brevzin commented Mar 10, 2020

The intent of the wording is that result of p < q for unequal function pointers is unspecified - but the way we get there is that [expr.rel]/4 defines when pointers to objects compare greater and then [expr.rel]/5 we fall through to "Otherwise, the result of each of the operators is unspecified."

Can we clean this up by inserting a new paragraph between [expr.rel]/4 and [expr.rel]/5 as follows:

The result of comparing unequal pointers to functions or pointers to member functions is unspecified.

Or something?

@timsong-cpp
Copy link
Contributor

We don't allow relational comparisons of pointers to members.

@jensmaurer
Copy link
Member

In which way is that "not clean"? There are a few more situations where comparing pointers is unspecified, and comparing function pointers is just one special case. Apparently, the right result falls out from the rules, so we're good.

@brevzin
Copy link
Contributor Author

brevzin commented Mar 10, 2020

@jensmaurer The pointer to object case is reasonable - we define right above here what it means to compare those, and specifies a clear partial ordering.

For the pointer to function case, we never even talk about what greater means. So I have to understand that I have to skip over the "Otherwise, if a pointer p compares greater than a pointer q" by way of p can't compare greater than a because we never say what that means. It's like solving a logic puzzle to figure out what the rules are...

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 6, 2020
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label May 28, 2021
@jensmaurer
Copy link
Member

Editorial meeting: Call out pointers to functions explicitly (as unspecified).

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

Successfully merging a pull request may close this issue.

3 participants