Checking Pre & Post Conditions

It is very important to state who checks the preconditions.

User guarantees preconditions: Main advantage is efficiency:

     PUSH(S,1);
     POP(S);
Postcondition of PUSH satisfies precondition of POP.

Implementation checks preconditions:

Selective code inclusion: cc -DSAFE ...

#ifdef SAFE
if (! condition) error("condition not satisfied");
#endif