Assertions and errors
Khem Raj December 17, 2024 #metaAssertions are checks for things which should never happen. We add them at places where we think "this is impossible to happen ..." unless we have that mindset we will not place them correctly, since the program is well tested so assertions might appear redundant. Sometimes we have "debug" build and "release" build where among other things assertions might be turned off citing a reason that they will only trigger with a bug and testing would have eliminated bug during development/testing cycles therefore they are redudant in production builds.
We are assuming testing finds every possible defect that can happen in field. In reality this is never the case.
They do have some overhead yes but the benefits outweighs the overhead.