Exception handlers

The concrete class TFPExceptionHandler provides for the automatic throwing of floating-point exceptions from within a try block. You pass its constructor a TFPExceptionSet object. The constructor:

  1. Saves its argument--the requested exceptions--for reference by the destructor
  2. Saves the current settings of the environment's exception flags--the old history
  3. Clears all of the environment's exception flags, creating a new history
As the block executes, exception flags will be raised and cleared as with any computation. At the end of the block, the destructor:

  1. Saves the now-current settings of the flags--the recent history
  2. Forms the complete history from the union of the old and recent histories, placing these flag settings in the environment
  3. Forms the offending exceptions, the intersection of the recent history and the requested exceptions; if there are any offending exceptions, the handler:
    1. Converts the one of highest priority to the corresponding TFPException derived class, passing the set of offending exceptions to the constructor
    2. Throws the exception object
The member functions GetRequestedExceptions and GetSavedExceptions give access to the requested exceptions and old history, respectively.


[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