4 ms·
That's why you define your own assert macro and keep in on unconditionally. Your programs will be better for it.
by samiv 6mo ago
That's why you define your own assert macro and keep in on unconditionally. Your programs will be better for it.
- jandrewrogers 6mo agoAn assertion can be arbitrarily expensive to evaluate. This may be worth the cost in a debug build but not in a release build. If all of assertions are cheap, they likely are not checking nearly as much as they could or should.
- samiv 6mo agoPossibly but I've never seen it in practice that some assert evaluation would be the first thing to optimize. Anyway should that happen then consider removing just that assert. That being said being slow or fast is kinda moot point if the program is not correct. So my advisor to leave always all asserts in. Offensive programming.