DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
No more ctime(S) errors - Time(C++)

Preconditions

Before a client calls any function of Time(C++), it is the client's responsibility to see to it that the preconditions for that function, if any, are satisfied. Failure to satisfy a precondition leads to undefined behavior. A core dump or an infinite loop might result; even worse, a problem might not turn up until much later in a way that would be difficult to trace.

An example of function with a precondition is the three-parameter Time constructor. One of the preconditions states that the arguments must represent a valid date. If this precondition is not satisfied--for example if the client does this:

       Time t(1989,Time::february,29);

then the behavior of the constructor is undefined (a core dump is one possible behavior).

There are generally two ways for a client programmer to guarantee that preconditions are satisfied:

In either case, programs that are known to be correct, either by virtue of correctness arguments or by explicit checking of preconditions, run as quickly as possible.
Next topic: Objections
Previous topic: Error handling

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005