Exception classes

The abstract class TFPException derives from TStandardException, the system-wide exception class. To each floating-point exception flag there corresponds a derived class:

  1. TFPInvalidException
  2. TFPOverflowException
  3. TFPUnderflowException
  4. TFPDivideByZeroException
  5. TFPInexactException.
This order determines which TFPException object will be thrown when a TFPExceptionHandler object detects more than one. TFPException objects maintain a TFPExceptionSet as their internal state. Constructors for these classes create objects with empty internal state unless a TFPExceptionSet object is passed.

The statement

    catch(const TFPInvalidException& invalidObject) { /* response to exception */ }
establishes a catch block for the invalid exception. If a TFPInvalidException is thrown in the associated try block, the catch block is executed, with invalidObject referring to the thrown exception object.

Throwing exceptions manually

Typically, TFPExceptionHandler objects create and throw TFPException objects, but you can instantiate and throw TFPException objects yourself.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker