[prev] 25 [next]

Exercise 2: pre- and post-conditions

Each Set operation has well-defined semantics.

Express these semantics in detail via statements of:

  • what conditions need to hold at start of function
  • what will hold at end of function (assuming successful)

Could be implemented as assert()s in functions

But only during the development/testing phase

  • assert() does not provide useful error-handling