HomePhabricator

Merge #13534: Don't assert(foo()) where foo() has side effects

Description

Merge #13534: Don't assert(foo()) where foo() has side effects

Summary:
6ad0328f1c Don't assert(foo()) where foo has side effects (practicalswift)

Pull request description:

Don't `assert(foo())` where `foo` has side effects.

From `assert(3)`:

> If the macro `NDEBUG` is defined at the moment `<assert.h>` was last included, the macro `assert()` generates no code, and hence does nothing at all.

Bitcoin currently cannot be compiled without assertions, but we shouldn't rely on that.

Tree-SHA512: 28cff0c6d1c2fb612ca58c9c94142ed01c5cfd0a2fecb8e59cdb6c270374b215d952ed3491d921d84dc1b439fa49da4f0e75e080f6adcbc6b0e08be14e54c170

Partial backport of Core PR13534
https://github.com/bitcoin/bitcoin/pull/13534/

Test Plan:

make check

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D4736

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Aug 13 2018, 14:02
nakihitoCommitted on Dec 17 2019, 18:21
jasonbcoxPushed on Dec 17 2019, 19:11
Reviewer
Restricted Owners Package
Differential Revision
D4736: Merge #13534: Don't assert(foo()) where foo() has side effects
Parents
rSTAGING7d378722c7f3: Merge #13662: Explain when reindex-chainstate can be used instead of reindex
Branches
Unknown
Tags
Unknown