tmp/tmpw2sx0rby/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,32 @@
|
|
| 1 |
### The `assert` macro <a id="assertions.assert">[[assertions.assert]]</a>
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
An expression `assert(E)` is a constant subexpression
|
| 4 |
[[defns.const.subexpr]], if
|
| 5 |
|
| 6 |
- `NDEBUG` is defined at the point where `assert` is last defined or
|
| 7 |
redefined, or
|
|
|
|
| 1 |
### The `assert` macro <a id="assertions.assert">[[assertions.assert]]</a>
|
| 2 |
|
| 3 |
+
If `NDEBUG` is defined as a macro name at the point in the source file
|
| 4 |
+
where `<cassert>` is included, the `assert` macro is defined as
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
#define assert(...) ((void)0)
|
| 8 |
+
```
|
| 9 |
+
|
| 10 |
+
Otherwise, the `assert` macro puts a diagnostic test into programs; it
|
| 11 |
+
expands to an expression of type `void` which has the following effects:
|
| 12 |
+
|
| 13 |
+
- `__VA_ARGS__` is evaluated and contextually converted to `bool`.
|
| 14 |
+
- If the evaluation yields `true` there are no further effects.
|
| 15 |
+
- Otherwise, the `assert` macro’s expression creates a diagnostic on the
|
| 16 |
+
standard error stream (ISO/IEC 9899:2018 (C), 7.23.3) in an
|
| 17 |
+
*implementation-defined* format and calls `abort()`. The diagnostic
|
| 18 |
+
contains `#``__VA_ARGS__` and information on the name of the source
|
| 19 |
+
file, the source line number, and the name of the enclosing function
|
| 20 |
+
(such as provided by `source_location::current()`).
|
| 21 |
+
|
| 22 |
+
If `__VA_ARGS__` does not expand to an *assignment-expression*, the
|
| 23 |
+
program is ill-formed.
|
| 24 |
+
|
| 25 |
+
The macro `assert` is redefined according to the current state of
|
| 26 |
+
`NDEBUG` each time that `<cassert>` is included.
|
| 27 |
+
|
| 28 |
An expression `assert(E)` is a constant subexpression
|
| 29 |
[[defns.const.subexpr]], if
|
| 30 |
|
| 31 |
- `NDEBUG` is defined at the point where `assert` is last defined or
|
| 32 |
redefined, or
|