3 ms·
I don't get it. In (non-wildly-buggy) code evaluating the argument to assert() is required to (a) succeed, and (b) have no side effects, so what would such a d
by cperciva 15y ago
I don't get it. In (non-wildly-buggy) code evaluating the argument to assert() is required to (a) succeed, and (b) have no side effects, so what would such a definition accomplish?
- barrkel 15y agoAssumptions: * asserts are used in a defensive programming style to state invariants * the enemy developers will be reasoning about the code assuming that asserts which didn't fire were true * when debugging, they'll read the code and prematurely dismiss valid theories as to why the bug exists based on what they read in the assertions
- cperciva 15y agoSure, but I don't think this matches the problem statement -- if the product is within a week or two of shipping, it should be long past the point where developers are tracking down bugs by using asserts to exclude possible code paths. If the problem was to slow down early development I'd absolutely agree with you.