exit ( -1 );

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
fabian.gerold
Posts: 15
Joined: Mon Aug 06, 2007 3:37 am
Location: Bauhaus University Weimar
Contact:

exit ( -1 );

Post by fabian.gerold »

Hi OpenSees developers.
There are many calls to exit ( -1 );
in OpenSees.
This is not a problem while running OpenSees as console application.
But when you link it to a gui program, it kills your whole application.
What do you think of using exceptions instead or returning an error value?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

yes, exceptions should be used in places like constructors where the exit is being used to stop a segmentation fault .. in other places the
class interface should be changed, e.g. setDomain should return an int .. they were not because when we started in 97 exceptions were not working for most of the compilers and the classes started to do more in certain methods than we ever thought they would.

we have it on our list of things to do for a version 2.0 release, just not sure when that will be.
fabian.gerold
Posts: 15
Joined: Mon Aug 06, 2007 3:37 am
Location: Bauhaus University Weimar
Contact:

Post by fabian.gerold »

Thank you for the answer. That sounds very good.
Post Reply