From Jason Turner

[intro.compliance]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1ua5tctf/{from.md → to.md} +89 -44
tmp/tmp1ua5tctf/{from.md → to.md} RENAMED
@@ -11,35 +11,43 @@ Although this document states only requirements on C++ implementations,
11
  those requirements are often easier to understand if they are phrased as
12
  requirements on programs, parts of programs, or execution of programs.
13
  Such requirements have the following meaning:
14
 
15
  - If a program contains no violations of the rules in [[lex]] through
16
- [[thread]] and [[depr]], a conforming implementation shall, within its
17
- resource limits as described in [[implimits]], accept and correctly
18
- execute[^3] that program.
19
  - If a program contains a violation of a rule for which no diagnostic is
20
  required, this document places no requirement on implementations with
21
  respect to that program.
22
- - Otherwise, if a program contains a violation of any diagnosable rule
23
- or an occurrence of a construct described in this document as
 
 
 
24
  “conditionally-supported” when the implementation does not support
25
- that construct, a conforming implementation shall issue at least one
26
- diagnostic message.
 
 
 
 
 
27
 
28
  [*Note 1*: During template argument deduction and substitution, certain
29
  constructs that in other contexts require a diagnostic are treated
30
  differently; see  [[temp.deduct]]. — *end note*]
31
 
32
- Furthermore, a conforming implementation
33
 
34
- - shall not accept a preprocessing translation unit containing a
35
- `#error` preprocessing directive [[cpp.error]],
36
- - shall issue at least one diagnostic message for each `#warning` or
37
- `#error` preprocessing directive not following a `#error`
38
- preprocessing directive in a preprocessing translation unit, and
39
- - shall not accept a translation unit with a *static_assert-declaration*
40
- that fails [[dcl.pre]].
41
 
42
  For classes and class templates, the library Clauses specify partial
43
  definitions. Private members [[class.access]] are not specified, but
44
  each implementation shall supply them to complete the definitions
45
  according to the description in the library Clauses.
@@ -56,82 +64,119 @@ header or importing the appropriate standard library named header unit
56
  The templates, classes, functions, and objects in the library have
57
  external linkage [[basic.link]]. The implementation provides definitions
58
  for standard library entities, as necessary, while combining translation
59
  units to form a complete C++ program [[lex.phases]].
60
 
61
- Two kinds of implementations are defined: a *hosted implementation* and
62
- a *freestanding implementation*. A freestanding implementation is one in
63
  which execution may take place without the benefit of an operating
64
  system. A hosted implementation supports all the facilities described in
65
  this document, while a freestanding implementation supports the entire
66
- C++ language described in [[lex]] through [[cpp]] and the subset of the
67
- library facilities described in [[compliance]].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  A conforming implementation may have extensions (including additional
70
  library functions), provided they do not alter the behavior of any
71
  well-formed program. Implementations are required to diagnose programs
72
  that use such extensions that are ill-formed according to this document.
73
  Having done so, however, they can compile and execute such programs.
74
 
75
  Each implementation shall include documentation that identifies all
76
  conditionally-supported constructs that it does not support and defines
77
- all locale-specific characteristics.[^4]
78
 
79
  ### Abstract machine <a id="intro.abstract">[[intro.abstract]]</a>
80
 
81
  The semantic descriptions in this document define a parameterized
82
  nondeterministic abstract machine. This document places no requirement
83
  on the structure of conforming implementations. In particular, they need
84
  not copy or emulate the structure of the abstract machine. Rather,
85
  conforming implementations are required to emulate (only) the observable
86
- behavior of the abstract machine as explained below.[^5]
87
 
88
  Certain aspects and operations of the abstract machine are described in
89
- this document as implementation-defined (for example, `sizeof(int)`).
90
- These constitute the parameters of the abstract machine. Each
91
- implementation shall include documentation describing its
92
- characteristics and behavior in these respects.[^6]
93
 
94
  Such documentation shall define the instance of the abstract machine
95
  that corresponds to that implementation (referred to as the
96
  “corresponding instance” below).
97
 
98
  Certain other aspects and operations of the abstract machine are
99
- described in this document as unspecified (for example, order of
100
- evaluation of arguments in a function call [[expr.call]]). Where
101
  possible, this document defines a set of allowable behaviors. These
102
  define the nondeterministic aspects of the abstract machine. An instance
103
  of the abstract machine can thus have more than one possible execution
104
  for a given program and a given input.
105
 
106
  Certain other operations are described in this document as undefined
107
- (for example, the effect of attempting to modify a const object).
 
108
 
109
- [*Note 1*: This document imposes no requirements on the behavior of
110
- programs that contain undefined behavior. — *end note*]
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  A conforming implementation executing a well-formed program shall
113
- produce the same observable behavior as one of the possible executions
114
- of the corresponding instance of the abstract machine with the same
115
- program and the same input. However, if any such execution contains an
116
- undefined operation, this document places no requirement on the
117
- implementation executing that program with that input (not even with
118
- regard to operations preceding the first undefined operation).
 
 
 
119
 
120
- The least requirements on a conforming implementation are:
 
 
 
 
 
 
 
 
121
 
122
  - Accesses through volatile glvalues are evaluated strictly according to
123
  the rules of the abstract machine.
124
- - At program termination, all data written into files shall be identical
125
- to one of the possible results that execution of the program according
126
- to the abstract semantics would have produced.
 
 
127
  - The input and output dynamics of interactive devices shall take place
128
  in such a fashion that prompting output is actually delivered before a
129
  program waits for input. What constitutes an interactive device is
130
  *implementation-defined*.
131
 
132
- These collectively are referred to as the *observable behavior* of the
133
- program.
134
-
135
- [*Note 2*: More stringent correspondences between abstract and actual
136
  semantics can be defined by each implementation. — *end note*]
137
 
 
11
  those requirements are often easier to understand if they are phrased as
12
  requirements on programs, parts of programs, or execution of programs.
13
  Such requirements have the following meaning:
14
 
15
  - If a program contains no violations of the rules in [[lex]] through
16
+ [[exec]] as well as those specified in [[depr]], a conforming
17
+ implementation shall accept and correctly execute[^2] that program,
18
+ except when the implementation’s limitations (see below) are exceeded.
19
  - If a program contains a violation of a rule for which no diagnostic is
20
  required, this document places no requirement on implementations with
21
  respect to that program.
22
+ - Otherwise, if a program contains
23
+ - a violation of any diagnosable rule,
24
+ - a preprocessing translation unit with a `#warning` preprocessing
25
+ directive [[cpp.error]],
26
+ - an occurrence of a construct described in this document as
27
  “conditionally-supported” when the implementation does not support
28
+ that construct, or
29
+ - a contract assertion [[basic.contract.eval]] evaluated with a
30
+ checking semantic in a manifestly constant-evaluated context
31
+ [[expr.const]] resulting in a contract violation,
32
+
33
+ a conforming implementation shall issue at least one diagnostic
34
+ message.
35
 
36
  [*Note 1*: During template argument deduction and substitution, certain
37
  constructs that in other contexts require a diagnostic are treated
38
  differently; see  [[temp.deduct]]. — *end note*]
39
 
40
+ Furthermore, a conforming implementation shall not accept
41
 
42
+ - a preprocessing translation unit containing a `#error` preprocessing
43
+ directive [[cpp.error]],
44
+ - a translation unit with a *static_assert-declaration* that fails
45
+ [[dcl.pre]], or
46
+ - a contract assertion evaluated with a terminating semantic
47
+ [[basic.contract.eval]] in a manifestly constant-evaluated context
48
+ [[expr.const]] resulting in a contract violation.
49
 
50
  For classes and class templates, the library Clauses specify partial
51
  definitions. Private members [[class.access]] are not specified, but
52
  each implementation shall supply them to complete the definitions
53
  according to the description in the library Clauses.
 
64
  The templates, classes, functions, and objects in the library have
65
  external linkage [[basic.link]]. The implementation provides definitions
66
  for standard library entities, as necessary, while combining translation
67
  units to form a complete C++ program [[lex.phases]].
68
 
69
+ An implementation is either a *hosted implementation* or a
70
+ *freestanding implementation*. A freestanding implementation is one in
71
  which execution may take place without the benefit of an operating
72
  system. A hosted implementation supports all the facilities described in
73
  this document, while a freestanding implementation supports the entire
74
+ C++ language described in [[lex]] through [[\lastcorechapter]] and the
75
+ subset of the library facilities described in [[compliance]].
76
+
77
+ It is *implementation-defined* whether the implementation is a
78
+ *hardened implementation*. If it is a hardened implementation, violating
79
+ a hardened precondition results in a contract violation
80
+ [[structure.specifications]].
81
+
82
+ An implementation is encouraged to document its limitations in the size
83
+ or complexity of the programs it can successfully process, if possible
84
+ and where known. [[implimits]] lists some quantities that can be subject
85
+ to limitations and a potential minimum supported value for each
86
+ quantity.
87
+
88
+ A conforming implementation may use an implementation-defined version of
89
+ the Unicode Standard that is a later version than the one referenced in
90
+ [[intro.refs]].
91
 
92
  A conforming implementation may have extensions (including additional
93
  library functions), provided they do not alter the behavior of any
94
  well-formed program. Implementations are required to diagnose programs
95
  that use such extensions that are ill-formed according to this document.
96
  Having done so, however, they can compile and execute such programs.
97
 
98
  Each implementation shall include documentation that identifies all
99
  conditionally-supported constructs that it does not support and defines
100
+ all locale-specific characteristics.[^3]
101
 
102
  ### Abstract machine <a id="intro.abstract">[[intro.abstract]]</a>
103
 
104
  The semantic descriptions in this document define a parameterized
105
  nondeterministic abstract machine. This document places no requirement
106
  on the structure of conforming implementations. In particular, they need
107
  not copy or emulate the structure of the abstract machine. Rather,
108
  conforming implementations are required to emulate (only) the observable
109
+ behavior of the abstract machine as explained below.[^4]
110
 
111
  Certain aspects and operations of the abstract machine are described in
112
+ this document as implementation-defined behavior (for example,
113
+ `sizeof(int)`). These constitute the parameters of the abstract machine.
114
+ Each implementation shall include documentation describing its
115
+ characteristics and behavior in these respects.[^5]
116
 
117
  Such documentation shall define the instance of the abstract machine
118
  that corresponds to that implementation (referred to as the
119
  “corresponding instance” below).
120
 
121
  Certain other aspects and operations of the abstract machine are
122
+ described in this document as unspecified behavior (for example, order
123
+ of evaluation of arguments in a function call [[expr.call]]). Where
124
  possible, this document defines a set of allowable behaviors. These
125
  define the nondeterministic aspects of the abstract machine. An instance
126
  of the abstract machine can thus have more than one possible execution
127
  for a given program and a given input.
128
 
129
  Certain other operations are described in this document as undefined
130
+ behavior (for example, the effect of attempting to modify a const
131
+ object).
132
 
133
+ Certain events in the execution of a program are termed
134
+ *observable checkpoints*.
135
+
136
+ [*Note 1*: A call to `std::observable_checkpoint` [[utility.undefined]]
137
+ is an observable checkpoint, as are certain parts of the evaluation of
138
+ contract assertions [[basic.contract]]. — *end note*]
139
+
140
+ The *defined prefix* of an execution comprises the operations O for
141
+ which for every undefined operation U there is an observable checkpoint
142
+ C such that O happens before C and C happens before U.
143
+
144
+ [*Note 2*: The undefined behavior that arises from a data race
145
+ [[intro.races]] occurs on all participating threads. — *end note*]
146
 
147
  A conforming implementation executing a well-formed program shall
148
+ produce the observable behavior of the defined prefix of one of the
149
+ possible executions of the corresponding instance of the abstract
150
+ machine with the same program and the same input. If the selected
151
+ execution contains an undefined operation, the implementation executing
152
+ that program with that input may produce arbitrary additional observable
153
+ behavior afterwards. If the execution contains an operation specified as
154
+ having erroneous behavior, the implementation is permitted to issue a
155
+ diagnostic and is permitted to terminate the execution at an unspecified
156
+ time after that operation.
157
 
158
+ *Recommended practice:* An implementation should issue a diagnostic when
159
+ such an operation is executed.
160
+
161
+ [*Note 3*: An implementation can issue a diagnostic if it can determine
162
+ that erroneous behavior is reachable under an implementation-specific
163
+ set of assumptions about the program behavior, which can result in false
164
+ positives. — *end note*]
165
+
166
+ The following specify the *observable behavior* of the program:
167
 
168
  - Accesses through volatile glvalues are evaluated strictly according to
169
  the rules of the abstract machine.
170
+ - Data is delivered to the host environment to be written into files
171
+ (See also: ISO C 7.23.3). \[*Note 4*: Delivering such data is followed
172
+ by an observable checkpoint [[cstdio.syn]]. Not all host environments
173
+ provide access to file contents before program
174
+ termination. — *end note*]
175
  - The input and output dynamics of interactive devices shall take place
176
  in such a fashion that prompting output is actually delivered before a
177
  program waits for input. What constitutes an interactive device is
178
  *implementation-defined*.
179
 
180
+ [*Note 5*: More stringent correspondences between abstract and actual
 
 
 
181
  semantics can be defined by each implementation. — *end note*]
182