Movatterモバイル変換


[0]ホーム

URL:


Issue 1003 - WG21 CWG Issues
Title
Acceptable definitions of main
Status
cd3
Section
6.10.3.1 [basic.start.main]
Submitter
Daniel Krügler

Created on2009-11-17.00:00:00 last changed145 months ago

Messages

msg3788 (view)
Date: 2012-02-15.00:00:00

[Voted into the WP at the February, 2012 meeting;moved to DR at the October, 2012 meeting.]

msg3425 (view)
Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

Change 6.10.3.1 [basic.start.main] paragraph 2 as follows:

...All implementations shallallow bothof the following definitions ofmain:

  int main() { /* ... */ }

and

  int main(int argc, char* argv[]) { /* ... */ }
  • function of() returningintand

  • function of(int, pointer to pointer tochar) returningint

as the type ofmain (9.3.4.6 [dcl.fct]. In the latter form, for purposes ofexposition, the first function parameter is calledargc andthe second function parameter is calledargv, whereargc shall be the number of arguments...

msg2582 (view)
Date: 2009-11-17.00:00:00

The specification of the forms of the definition ofmainthat an impliementation is required to accept is clear in C99 thatthe parameter names and the exact syntactic form of the types canvary. Although it is reasonable to assume that a C++ implementationwould accept a definition like

    int main(int foo, char** bar) { /* ... */ }

instead of the canonical

    int main(int argc, char* argv[]) { /* ... */ }

it might be a good idea to clarify the intent using wordingsimilar to C99's.

History
DateUserActionArgs
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-02-27 00:00:00adminsetmessages: +msg3788
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-09-06 00:00:00adminsetmessages: +msg3425
2011-09-06 00:00:00adminsetstatus: open -> ready
2009-11-17 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp