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

"main()" vs. "main function" #1304

Closed
alexanderkscott opened this issue Dec 31, 2016 · 3 comments
Closed

"main()" vs. "main function" #1304

alexanderkscott opened this issue Dec 31, 2016 · 3 comments
Assignees

Comments

@alexanderkscott
Copy link
Contributor

Excerpts from the standard:

are not caught by a function-try-block on main().
a program whose function main() contains
Control can be transferred directly to such a main() by throwing an exception that is caught in main().

In my opinion, the empty parentheses look sloppy and "main function" would be better.

Another question is whether the "main" should be in code font. Currently there are a few instances of both "main function" (normal font) and of "main function" (code font).

@jensmaurer
Copy link
Member

Yes, the parens should go.

In my opinion, "main" function should be code font: It's a bit of text that appears verbatim in user source code, and we're actually talking about the function spelled that way. (As opposed to, say, an inline function, which may or may not be declared with the inline keyword.)

@tkoeppe
Copy link
Contributor

tkoeppe commented Dec 31, 2016

We still have a fair amount of places where we confuse functions and function calls. I recommend deciding on a direction with @zygoloid before putting any work into this.

@jensmaurer
Copy link
Member

jensmaurer commented Dec 31, 2016

@tkoeppe: I'm sorry, I don't see your point in the context of the "main" function. We might have confusion between a function and a function call somewhere (examples?), but this issue is clearly not about calls, but about the structure of the "main" function. ("main" can't be called by the user, anyway.)

I'll prepare a patch to use \tcode{main} everywhere, plus a cross-reference to [basic.start.main]. These improvements should also address any questions whether, in some cases, a member function "main" might be meant (it isn't).

@jensmaurer jensmaurer self-assigned this Dec 31, 2016
jensmaurer added a commit to jensmaurer/draft that referenced this issue Dec 31, 2016
Consistently use \tcode{main}.
Add cross-references to [basic.start.main].

Fixes cplusplus#1304.
zygoloid pushed a commit that referenced this issue Feb 5, 2017
Consistently use \tcode{main}.
Add cross-references to [basic.start.main].

Fixes #1304.
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