NAME

OTCERR_AssertionFailure - Exception class to be thrown for a failed assertion.

SYNOPSIS


#include <OTC/debug/asrtfail.hh>

class OTCERR_AssertionFailure : public OTC_Exception
{
  public:
    ~OTCERR_AssertionFailure();
    OTCERR_AssertionFailure(
      char const* theFile,
      u_int theLine,
      char const* theCondition
    );
    OTCERR_AssertionFailure(
      OTCERR_AssertionFailure const& theException
    );
    inline char const* condition() const;
    void display(ostream& outs) const;
};

CLASS TYPE

Concrete

DESCRIPTION

This class is to be used, when you want to throw an exception for an assertion failure. It is this exception which is thrown by OTCLIB_ASSERT() when the condition fails. Typically, you would not use this class directly but would use OTCLIB_ASSERT(). If used explicitly this class would be used in the following way: The prefered method of using this class though is to write: When OTCLIB_ASSERT() is used it will be compiled out of code, if the symbol NDEBUG is defined. Assertions would generally only be used during development of software. If you are using makeit, the symbol NDEBUG is automatically defined, when working in the opt variant. If a condition check is required to be permanently in code, ie., it is a precondition of the code that the condition always be true; you should use the OTCERR_PreconditionFailure exception class, or the OTCLIB_ENSURE() macro.

INITIALISATION

OTCERR_AssertionFailure(
  char const* theFile,
  u_int theLine,
  char const* theCondition
);
OTCERR_AssertionFailure(OTCERR_AssertionFailure const& theException);

QUERY

inline char const* condition() const;

DISPLAY

void display(ostream& outs) const;

SEE ALSO

OTC_Exception, OTCLIB_ENSURE, OTCLIB_ASSERT

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED