cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[basic.start.main] Restrictions of the `main` function on a freestanding implementation not requiring it #483

Closed frederick-vs-ja closed 6 months ago

frederick-vs-ja commented 6 months ago

Full name of submitter (unless configured in github; will be published with the issue): Jiang An

Reference (section label): [basic.start.main]

Link to reflector thread (if any):

Issue description:

It seems that the restrictions and special semantics always apply to the main function, even on a freestanding implementation not requiring it.

Perhaps we should only require a freestanding implementation not to predefine main, and skip the rest of [basic.start.main] if the implementation doesn't require main.

Suggested resolution:

jensmaurer commented 6 months ago

Right, even on freestanding, your main must have the correct signature and not be a coroutine etc, and you can't mention it in your program other than to declare it, even though your implementation might not actually call it.

That's what the rules say, and I think it keeps everybody's portability sanity to enforce the "main" rules everywhere.

The text itself seems clear in this regard; thus I'm not seeing a core issue. Any actual change to the requirements needs a paper to EWG.