tmp/tmpuoj3r9__/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Indeterminate values <a id="basic.indet">[[basic.indet]]</a>
|
| 2 |
+
|
| 3 |
+
When storage for an object with automatic or dynamic storage duration is
|
| 4 |
+
obtained, the object has an *indeterminate value*, and if no
|
| 5 |
+
initialization is performed for the object, that object retains an
|
| 6 |
+
indeterminate value until that value is replaced [[expr.ass]].
|
| 7 |
+
|
| 8 |
+
[*Note 1*: Objects with static or thread storage duration are
|
| 9 |
+
zero-initialized, see [[basic.start.static]]. — *end note*]
|
| 10 |
+
|
| 11 |
+
If an indeterminate value is produced by an evaluation, the behavior is
|
| 12 |
+
undefined except in the following cases:
|
| 13 |
+
|
| 14 |
+
- If an indeterminate value of unsigned ordinary character type
|
| 15 |
+
[[basic.fundamental]] or `std::byte` type [[cstddef.syn]] is produced
|
| 16 |
+
by the evaluation of:
|
| 17 |
+
- the second or third operand of a conditional expression
|
| 18 |
+
[[expr.cond]],
|
| 19 |
+
- the right operand of a comma expression [[expr.comma]],
|
| 20 |
+
- the operand of a cast or conversion ([[conv.integral]],
|
| 21 |
+
[[expr.type.conv]], [[expr.static.cast]], [[expr.cast]]) to an
|
| 22 |
+
unsigned ordinary character type or `std::byte` type
|
| 23 |
+
[[cstddef.syn]], or
|
| 24 |
+
- a discarded-value expression [[expr.context]],
|
| 25 |
+
|
| 26 |
+
then the result of the operation is an indeterminate value.
|
| 27 |
+
- If an indeterminate value of unsigned ordinary character type or
|
| 28 |
+
`std::byte` type is produced by the evaluation of the right operand of
|
| 29 |
+
a simple assignment operator [[expr.ass]] whose first operand is an
|
| 30 |
+
lvalue of unsigned ordinary character type or `std::byte` type, an
|
| 31 |
+
indeterminate value replaces the value of the object referred to by
|
| 32 |
+
the left operand.
|
| 33 |
+
- If an indeterminate value of unsigned ordinary character type is
|
| 34 |
+
produced by the evaluation of the initialization expression when
|
| 35 |
+
initializing an object of unsigned ordinary character type, that
|
| 36 |
+
object is initialized to an indeterminate value.
|
| 37 |
+
- If an indeterminate value of unsigned ordinary character type or
|
| 38 |
+
`std::byte` type is produced by the evaluation of the initialization
|
| 39 |
+
expression when initializing an object of `std::byte` type, that
|
| 40 |
+
object is initialized to an indeterminate value.
|
| 41 |
+
|
| 42 |
+
[*Example 1*:
|
| 43 |
+
|
| 44 |
+
``` cpp
|
| 45 |
+
int f(bool b) {
|
| 46 |
+
unsigned char c;
|
| 47 |
+
unsigned char d = c; // OK, d has an indeterminate value
|
| 48 |
+
int e = d; // undefined behavior
|
| 49 |
+
return b ? d : 0; // undefined behavior if b is true
|
| 50 |
+
}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
— *end example*]
|
| 54 |
+
|