View Issue Details

IDProjectCategoryView StatusLast Update
0012131Open CASCADEOCCT:Foundation Classespublic2012-07-24 22:37
ReporterpdnAssigned Topdn 
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
OSAll 
Fixed in Version6.1.1 
Summary0012131: Improvement of Exception mechanism on Unix and Linux platforms
DescriptionInitial idea is IFMT 190

Currently Open CASCADE redefines try and catch operators on UNIX by macros, thus
replacing C++ exception handling by emulation based on longjumps. This is needed
to be able to handle C signals (like SIGSEGV, FPE etc) in the same syntax as C++
exceptions (which is possible only with longjumps -- see IFMT 91 or report on
FIP 1.7 on OCN TC page for details

The idea is to eliminate all the mentioned problems by converting signals to
true C++ exceptions
and making other necessary improvements. Note that we still need to use
longjumps to go from signal
handler to the place where C++ exception can be raised; this can naturally be
the beginning of
the try{} block.

Unfortunately, we will need to insert explicitly a specific code (macros)
converting signal to true exception into every try block that has to handle
signals (see Comment for alternative idea how to avoid this that turned to be
unfeasible)
Additional information
and documentation updates
Documentation remark, added by ABV 2006-08-09 12:28:05:

New features:


Improvements:


Changes:
Implementation of exceptions and signals handling on Linux and UNIX platforms
has been changed. Note that existing code involving try {} statements shall be
updated (see below).

Now exceptions are raised and handled as normal C++ exceptions, not emulated by
C longjumps as before.

This provides the following advantages over previous version:

- Use of OCC library in the program that uses C++ exceptions does not require
special work-arounds to provide consistent exception handling

- Generic catch(...) with period can be used without conflicting with OCC code
(as it was with some implementations of STL)

- Exception raised after catch() {} but in the same code block will not be
erroneously caught by this catch. Two consequtive try{} catch{} blocks are
possible within the same code block.

- C++ stack unwinding, with appropriate destruction of objects allocated in the
stack, is be performed.

However, handling of signals is still performed with longjmp functions (on UNIX
and Linux systems). To be able to catch signal as exception, the macro OCC_CATCH
_SIGNALS should be inserted in the code. This macro instantiates signal
handling object; in case of software signal the execution will return to this
point and appropriate exception will be raised from this macro.

It is recommended to insert OCC_CATCH_SIGNALS macro as a first statement in
every try {} block containing code which may generate signal (for instance,
generic try {} blocks catching Standard_Failure).

See Foundation Classes User's Guide for more details.

Note that this change is controlled by new compiler option OCC_CONVERT_SIGNALS.
Old option NO_CXX_EXCEPTIONS is kept for compatibility; it still can be used to
provide the same behaviour as in previous versions of OCCT.

Modified entities:
** NOTE for ATP: the FDC UG shall be also updated in this regard
TagsNo tags attached.
Test case number

Attached Files

  • OCC12131.tar.gz (831,292 bytes)
  • L8 (866 bytes)
  • OCC12131_Products.tar.gz (169,552 bytes)

Relationships

related to 0013149 closedpdn Following of exception improvement 
related to 0009755 closedpdn Incorrect behavior of try - catch macro 

Activities

2006-04-07 08:57

 

OCC12131.tar.gz (831,292 bytes)

2006-06-19 10:07

 

L8 (866 bytes)

2006-07-05 09:30

 

OCC12131_Products.tar.gz (169,552 bytes)

Issue History

Date Modified Username Field Change
2006-04-07 11:02 pdn CC => abv
2006-04-07 11:08 bugmaster Assigned To bugmaster => pdn
2006-04-07 11:08 bugmaster Status new => assigned
2006-04-07 11:08 bugmaster Category => FDC
2006-04-07 11:08 bugmaster Status assigned => tested
2006-04-07 11:10 bugmaster CC => imv
2006-05-23 09:19 bugmaster Status tested => verified
2006-08-08 17:57 pdn BugsThisDependsOn => 13149
2007-01-12 14:01 bugmaster Status verified => closed
2007-01-12 14:01 bugmaster Resolution @0@ => fixed
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2012-01-13 16:16 atp Description Updated
2012-01-13 16:16 atp Additional Information Updated
2012-07-24 22:35 abv Relationship added related to 0009755
2012-07-24 22:37 abv Description Updated