From Jason Turner

[basic.start.main]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpissfpxxe/{from.md → to.md} +10 -10
tmp/tmpissfpxxe/{from.md → to.md} RENAMED
@@ -26,24 +26,24 @@ function parameter is called `argv`, where `argc` shall be the number of
26
  arguments passed to the program from the environment in which the
27
  program is run. If `argc` is nonzero these arguments shall be supplied
28
  in `argv[0]` through `argv[argc - 1]` as pointers to the initial
29
  characters of null-terminated multibyte strings (NTMBSs)
30
  [[multibyte.strings]] and `argv[0]` shall be the pointer to the initial
31
- character of a NTMBS that represents the name used to invoke the program
32
- or `""`. The value of `argc` shall be non-negative. The value of
33
  `argv[argc]` shall be 0.
34
 
35
  *Recommended practice:* Any further (optional) parameters should be
36
  added after `argv`.
37
 
38
- The function `main` shall not be used within a program. The linkage
39
  [[basic.link]] of `main` is *implementation-defined*. A program that
40
  defines `main` as deleted or that declares `main` to be `inline`,
41
  `static`, `constexpr`, or `consteval` is ill-formed. The function `main`
42
  shall not be a coroutine [[dcl.fct.def.coroutine]]. The `main` function
43
- shall not be declared with a *linkage-specification* [[dcl.link]]. A
44
- program that declares
45
 
46
  - a variable `main` that belongs to the global scope, or
47
  - a function `main` that belongs to the global scope and is attached to
48
  a named module, or
49
  - a function template `main` that belongs to the global scope, or
@@ -59,11 +59,11 @@ calling the function `std::exit(int)` [[support.start.term]]) does not
59
  destroy any objects with automatic storage duration [[class.dtor]]. If
60
  `std::exit` is invoked during the destruction of an object with static
61
  or thread storage duration, the program has undefined behavior.
62
 
63
  A `return` statement [[stmt.return]] in `main` has the effect of leaving
64
- the main function (destroying any objects with automatic storage
65
- duration) and calling `std::exit` with the return value as the argument.
66
- If control flows off the end of the *compound-statement* of `main`, the
67
- effect is equivalent to a `return` with operand `0` (see also
68
- [[except.handle]]).
69
 
 
26
  arguments passed to the program from the environment in which the
27
  program is run. If `argc` is nonzero these arguments shall be supplied
28
  in `argv[0]` through `argv[argc - 1]` as pointers to the initial
29
  characters of null-terminated multibyte strings (NTMBSs)
30
  [[multibyte.strings]] and `argv[0]` shall be the pointer to the initial
31
+ character of an NTMBS that represents the name used to invoke the
32
+ program or `""`. The value of `argc` shall be non-negative. The value of
33
  `argv[argc]` shall be 0.
34
 
35
  *Recommended practice:* Any further (optional) parameters should be
36
  added after `argv`.
37
 
38
+ The function `main` shall not be named by an expression. The linkage
39
  [[basic.link]] of `main` is *implementation-defined*. A program that
40
  defines `main` as deleted or that declares `main` to be `inline`,
41
  `static`, `constexpr`, or `consteval` is ill-formed. The function `main`
42
  shall not be a coroutine [[dcl.fct.def.coroutine]]. The `main` function
43
+ shall not be declared with a *linkage-specification* [[dcl.link]] other
44
+ than `"C++"`. A program that declares
45
 
46
  - a variable `main` that belongs to the global scope, or
47
  - a function `main` that belongs to the global scope and is attached to
48
  a named module, or
49
  - a function template `main` that belongs to the global scope, or
 
59
  destroy any objects with automatic storage duration [[class.dtor]]. If
60
  `std::exit` is invoked during the destruction of an object with static
61
  or thread storage duration, the program has undefined behavior.
62
 
63
  A `return` statement [[stmt.return]] in `main` has the effect of leaving
64
+ the `main` function (destroying any objects with automatic storage
65
+ duration and evaluating any postcondition assertions of `main`) and
66
+ calling `std::exit` with the return value as the argument. If control
67
+ flows off the end of the *compound-statement* of `main`, the effect is
68
+ equivalent to a `return` with operand `0` (see also [[except.handle]]).
69