Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
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 <setjmp.h>
#include <variant>
#include <iostream>
#include <OSD_SIGBUS.hxx>
#include <OSD_SIGHUP.hxx>
#include <OSD_SIGILL.hxx>
#include <OSD_SIGINT.hxx>
#include <OSD_SIGKILL.hxx>
#include <OSD_SIGQUIT.hxx>
#include <OSD_SIGSEGV.hxx>
#include <OSD_SIGSYS.hxx>
#include <OSD_Exception_ACCESS_VIOLATION.hxx>
#include <OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx>
#include <OSD_Exception_ILLEGAL_INSTRUCTION.hxx>
#include <OSD_Exception_IN_PAGE_ERROR.hxx>
#include <OSD_Exception_INT_OVERFLOW.hxx>
#include <OSD_Exception_INVALID_DISPOSITION.hxx>
#include <OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx>
#include <OSD_Exception_PRIV_INSTRUCTION.hxx>
#include <OSD_Exception_STACK_OVERFLOW.hxx>
#include <OSD_Exception_STATUS_NO_MEMORY.hxx>
#include <Standard_DivideByZero.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_Overflow.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_Underflow.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