Open CASCADE Technology  7.3.0
Data Structures | Macros | Typedefs

Standard_ErrorHandler.hxx File Reference

Support of handling of C signals as C++-style exceptions, and implementation of C++ exception handling on platforms that do not implement these natively. More...

#include <Standard.hxx>
#include <Standard_Handle.hxx>
#include <Standard_PErrorHandler.hxx>
#include <Standard_JmpBuf.hxx>
#include <Standard_HandlerStatus.hxx>
#include <Standard_ThreadId.hxx>
#include <Standard_Type.hxx>

Data Structures

class  Standard_ErrorHandler
 Class implementing mechanics of conversion of signals to exceptions. More...
 
class  Standard_ErrorHandler::Callback
 Defines a base class for callback objects that can be registered in the OCC error handler (the class simulating C++ exceptions) so as to be correctly destroyed when error handler is activated. More...
 

Macros

#define OCC_CATCH_SIGNALS
 

Typedefs

typedef Standard_ErrorHandler::Callback Standard_ErrorHandlerCallback
 

Detailed Description

Support of handling of C signals as C++-style exceptions, and implementation of C++ exception handling on platforms that do not implement these natively.

The implementation is based on C long jumps.

If macro OCC_CONVERT_SIGNALS is defined, this enables macro OCC_CATCH_SIGNALS that can be used in the code (often inside try {} blocks) to convert C-style signals to standard C++ exceptions. This works only when OSD::SetSignal() is called to set appropriate signal handler. In the case of signal (like access violation, division by zero, etc.) it will jump to the nearest OCC_CATCH_SIGNALS in the call stack, which will then throw a C++ exception. This method is useful for Unix and Linux systems where C++ exceptions cannot be thrown from C signal handler.

On Windows with MSVC compiler, exceptions can be thrown directly from signal handler, this OCC_CONVERT_SIGNALS is not needed. Note however that this requires that compiler option /EHa is used.

Macro Definition Documentation

◆ OCC_CATCH_SIGNALS

#define OCC_CATCH_SIGNALS

Typedef Documentation

◆ Standard_ErrorHandlerCallback