An improved assert()

assert() is a very useful tool for ensuring that pre- and post-conditions, as well as invariants, are met upon calling or exiting a function. If you have never used assertions before, start using them now – they will help you find bugs in your own code, and quickly highlight when code is not used in the way originally intended.

Still, there are a few bits missing in the standard assert(), which is why we will try to build an improved version of it today.

Continue reading

Advertisements