[Next] [Prev] [Up] [Top]

16.0 Assertions/Debugging

ASSERTION


This macro provides a means of documenting in code the assumptions about the valid state of the program. It takes a boolean condition and a string. If the condition evaluates to true, nothing is done. If it is false, an error message is reported and the program is terminated.

void X :: foo (X* parent)

{

METHOD (X :: foo):

ASSERTION (parent != NULL, "parent pointer is valid"):

... code body

}

For Unix, the error message is printed to stderr.

For the PC, the error message goes to afxDump..


No Title
[Next] [Prev] [Up] [Top]

Generated with CERN WebMaker

This site was grabbed using the TRIAL version of Grab-a-Site. This message does not appear on a licensed copy of Grab-a-Site.