3 ms·
Isnt just assert the error condition how assert is actually intended to be used?
by andi999 5y ago
Isnt just assert the error condition how assert is actually intended to be used?
- masklinn 5y agoDepends. The issue is that since `assert` is stripped out in “O” mode, if the codebase depends on `assert` for correctness… they’re not compatible.
- andi999 5y agoWhat do you mean by depends on assert for correctness? How?
- Doxin 5y agoget_president_inside_bunker() assert president_is_inside_bunker() close_bunker_doors() assert bunker_doors_are_closed() send_nukes() With asserts enabled this is fine. With asserts disabled you might start sending nukes while the president is still outside or the doors to the bunker are still open.