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

"Equivalent to return foo();" vs. "Equivalent to foo()". #679

Closed
timsong-cpp opened this issue Apr 7, 2016 · 4 comments
Closed

"Equivalent to return foo();" vs. "Equivalent to foo()". #679

timsong-cpp opened this issue Apr 7, 2016 · 4 comments

Comments

@timsong-cpp
Copy link
Contributor

Outside of this commit, it looks like most uses of the magic words "equivalent to" for a value-returning function is of the form

Effects: Equivalent to return foo();

or

Effects: Equivalent to foo()
Returns: bar.

That commit stripped a bunch of returns from "equivalent to"s of the first form, so that it's instead

Effects: Equivalent to foo().

The inconsistency seems...odd.

@burblebee
Copy link
Contributor

The returns which were removed in that commit were added back in 0586a06 after some discussion with library folks and Richard. As it turns out, you can either describe the return value via a 'return' there in the Effects:, or in a Returns: clause. It seems to be up to the library authors as to which method they prefer to use. That said, the inconsistency bothers me too - I found it to be confusing.

I don't know if you want to close this now, given that the inconsistency appears to be intended? I did ask the library folks to go through the spec and make sure the returns/Returns are how they want them to be, as part of a related issue.

One thing I'd like to change is to add a : after the Equivalent to: when it is followed by a code block - I think that would help to at least know when we are introducing a code block, but no one has replied to me on that.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 23, 2016

I think there's a distinction: "Effects: Equivalent to return foo();" leaves it up to the implementation, whereas "Returns: foo()." prescribes a specific implementation.

@jensmaurer
Copy link
Member

Note that "Equivalent to" has special meaning; see 17.4.1.4p4.

@jensmaurer
Copy link
Member

I don't think there's anything to be done for this issue that wouldn't be covered by #1119.

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

4 participants