mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd: Update README note on assert().
This commit is contained in:
parent
26e04ecda4
commit
58c26b616c
1 changed files with 13 additions and 2 deletions
|
@ -69,5 +69,16 @@ which count characters printed *not including null*. They may return a
|
|||
- Consider any code inside a runtime `assert()` statement to **entirely**
|
||||
disappear in optimized builds. Some implementations of `assert()` may only
|
||||
elide the boolean check and thus preserve the inner statement and the effects
|
||||
of its execution. We do not rely on this. Consider `assert()` to be a
|
||||
preprocessor macro like assert(*actual characters entirely erased*).
|
||||
of its execution. We do not rely on this. Do not use `assert()` to check
|
||||
return values of statements that need to be executed in optimized builds.
|
||||
|
||||
- Furthermore, consider the **assert statement itself to be physically erased**
|
||||
from the code during optimized builds. Thus the following is a big mistake:
|
||||
|
||||
```
|
||||
if(foo)
|
||||
assert(!bar);
|
||||
|
||||
if(baz)
|
||||
bam();
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue