View Issue Details

IDProjectCategoryView StatusLast Update
0026924CommunityOCCT:Codingpublic2017-04-20 10:17
ReporterEpy Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionno change required 
Target Version7.2.0 
Summary0026924: Use of exit() in a shared library
DescriptionOCCT uses exit() in quite a few places; the general consensus is that using exit() in a shared library is a no-no because it prevents the application using OCCT from proper cleanup and notifying the user of what happened, etc. I realize it would be a large undertaking, but OCCT should return error codes, or use exceptions, etc. instead of using exit().
TagsNo tags attached.
Test case number

Relationships

parent of 0026937 closedapn Eliminate NO_CXX_EXCEPTION macro support 

Activities

abv

2015-11-25 01:06

manager   ~0048541

The places where OCCT code calls exit() are:

- Draw_BasicCommands.cxx: abort of the program if its execution time is over the defined limit (considered as hang up). This is necessary in tests to avoid blocking the process if some test hangs.

- Draw_Window.cxx: exit if DRAW application cannot initialize.

- lex.ExprIntrp.c and lex.step.c: exit() is part of the standard code generated by Flex scanner, not actually called from anywhere -- another error function is used instead.

- OSD_File.cxx: exit() is inside piece of dead code, to be removed.

- OSD_signal.cxx: exit() is called from signal handler in case when jumping did not succeeded. This can be improved by resetting handler to default and re-raising signal, as described in (I am not sure if this makes any real difference):
 http://www.gnu.org/software/libc/manual/html_node/Termination-in-Handler.html

- OSD_signal_WNT.cxx: exit() is called if the user selects to abort the program explicitly on the case of exception (special debug mode)

- Standard_ErrorHandler.cxx: exit() is called in situation when no landing point can be found to return from signal handler... This is used only when NO_CXX_EXCEPTION is defined, which is obsolete (used in the past for old compilers not supporting C++ exceptions) and should be removed.

Thus I believe that all actual uses of exit() are legitime and necessary, though some code around can be revised and cleaned up. If you have some particular complaints or know situation when exit() is called not in appropriate situation, please explain this.

kgv

2017-04-19 16:40

developer   ~0065353

Dear bugmaster,

please close the issue as no change required (see Andrey's comment).

Issue History

Date Modified Username Field Change
2015-11-24 23:42 Epy New Issue
2015-11-24 23:42 Epy Assigned To => kgv
2015-11-25 01:06 abv Note Added: 0048541
2015-11-30 12:00 Roman Lygin Relationship added parent of 0026937
2016-01-06 16:30 abv Target Version => 7.1.0
2016-11-03 17:13 abv Target Version 7.1.0 => 7.2.0
2017-04-19 16:40 kgv Note Added: 0065353
2017-04-19 16:40 kgv Assigned To kgv => bugmaster
2017-04-19 16:40 kgv Status new => feedback
2017-04-19 16:40 kgv Resolution open => no change required
2017-04-20 10:17 bugmaster Status feedback => closed