From Jason Turner

[basic.start.main]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzisyyoz3/{from.md → to.md} +18 -22
tmp/tmpzisyyoz3/{from.md → to.md} RENAMED
@@ -8,37 +8,33 @@ function. In a freestanding environment, start-up and termination is
8
  constructors for objects of namespace scope with static storage
9
  duration; termination contains the execution of destructors for objects
10
  with static storage duration.
11
 
12
  An implementation shall not predefine the `main` function. This function
13
- shall not be overloaded. It shall have a return type of type `int`, but
14
- otherwise its type is *implementation-defined*. All implementations
15
- shall allow both of the following definitions of `main`:
16
 
17
- ``` cpp
18
- int main() { /* ... */ }
19
- ```
20
 
21
- and
22
-
23
- ``` cpp
24
- int main(int argc, char* argv[]) { /* ... */ }
25
- ```
26
-
27
- In the latter form `argc` shall be the number of arguments passed to the
28
- program from the environment in which the program is run. If `argc` is
29
- nonzero these arguments shall be supplied in `argv[0]` through
30
- `argv[argc-1]` as pointers to the initial characters of null-terminated
31
- multibyte strings (NTMBS s) ([[multibyte.strings]]) and `argv[0]` shall
32
- be the pointer to the initial character of a NTMBSthat represents the
33
- name used to invoke the program or `""`. The value of `argc` shall be
34
- non-negative. The value of `argv[argc]` shall be 0. It is recommended
35
- that any further (optional) parameters be added after `argv`.
36
 
37
  The function `main` shall not be used within a program. The linkage (
38
  [[basic.link]]) of `main` is *implementation-defined*. A program that
39
- defines `main` as deleted or that declares `main` to be `inline,`
40
  `static`, or `constexpr` is ill-formed. The name `main` is not otherwise
41
  reserved. member functions, classes, and enumerations can be called
42
  `main`, as can entities in other namespaces.
43
 
44
  Terminating the program without leaving the current block (e.g., by
 
8
  constructors for objects of namespace scope with static storage
9
  duration; termination contains the execution of destructors for objects
10
  with static storage duration.
11
 
12
  An implementation shall not predefine the `main` function. This function
13
+ shall not be overloaded. It shall have a declared return type of type
14
+ `int`, but otherwise its type is *implementation-defined*. An
15
+ implementation shall allow both
16
 
17
+ - a function of `()` returning `int` and
18
+ - a function of `(int`, pointer to pointer to `char)` returning `int`
 
19
 
20
+ as the type of `main` ([[dcl.fct]]). In the latter form, for purposes
21
+ of exposition, the first function parameter is called `argc` and the
22
+ second function parameter is called `argv`, where `argc` shall be the
23
+ number of arguments passed to the program from the environment in which
24
+ the program is run. If `argc` is nonzero these arguments shall be
25
+ supplied in `argv[0]` through `argv[argc-1]` as pointers to the initial
26
+ characters of null-terminated multibyte strings (NTMBS s) (
27
+ [[multibyte.strings]]) and `argv[0]` shall be the pointer to the initial
28
+ character of a NTMBSthat represents the name used to invoke the program
29
+ or `""`. The value of `argc` shall be non-negative. The value of
30
+ `argv[argc]` shall be 0. It is recommended that any further (optional)
31
+ parameters be added after `argv`.
 
 
 
32
 
33
  The function `main` shall not be used within a program. The linkage (
34
  [[basic.link]]) of `main` is *implementation-defined*. A program that
35
+ defines `main` as deleted or that declares `main` to be `inline`,
36
  `static`, or `constexpr` is ill-formed. The name `main` is not otherwise
37
  reserved. member functions, classes, and enumerations can be called
38
  `main`, as can entities in other namespaces.
39
 
40
  Terminating the program without leaving the current block (e.g., by