diff --git a/Src/Array.h b/Src/Array.h index 95d71c4e..c61ef881 100644 --- a/Src/Array.h +++ b/Src/Array.h @@ -37,7 +37,7 @@ DAMAGE. #ifdef _WIN32 #define ASSERT( x ) { if( !( x ) ) _asm{ int 0x03 } } #else // !_WIN32 -#define ASSERT( x ) { if( !( x ) ) exit(0); } +#define ASSERT( x ) { if( !( x ) ) exit(1); } #endif // _WIN32 #endif // _WIN64 diff --git a/Src/LinearSolvers.h b/Src/LinearSolvers.h index a68c94cc..323b98c8 100644 --- a/Src/LinearSolvers.h +++ b/Src/LinearSolvers.h @@ -288,7 +288,7 @@ class EigenSolverCholeskyLLt : public EigenSolver< Real , MatrixRowIterator > #else // !STORE_EIGEN_MATRIX _solver.factorize( eigenM ); #endif // STORE_EIGEN_MATRIX - if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::EigenSolverCholeskyLLt Failed to factorize matrix\n" ) , exit(0); + if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::EigenSolverCholeskyLLt Failed to factorize matrix\n" ) , exit(1); } _eigenB.resize( M.rows() ); } @@ -309,10 +309,10 @@ class EigenSolverCholeskyLLt : public EigenSolver< Real , MatrixRowIterator > switch( _solver.info() ) { case Eigen::Success: break; - case Eigen::NumericalIssue: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (numerical issue)\n" ) , exit(0); - case Eigen::NoConvergence: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (no convergence)\n" ) , exit(0); - case Eigen::InvalidInput: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (invalid input)\n" ) , exit(0); - default: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix\n" ) , exit(0); + case Eigen::NumericalIssue: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (numerical issue)\n" ) , exit(1); + case Eigen::NoConvergence: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (no convergence)\n" ) , exit(1); + case Eigen::InvalidInput: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (invalid input)\n" ) , exit(1); + default: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix\n" ) , exit(1); } } void solve( ConstPointer( Real ) b , Pointer( Real ) x ) @@ -350,7 +350,7 @@ class EigenSolverCholeskyLDLt : public EigenSolver< Real , MatrixRowIterator > if( !analyzeOnly ) { _solver.factorize( eigenM ); - if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::EigenSolverCholeskyLDLt Failed to factorize matrix\n" ) , exit(0); + if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::EigenSolverCholeskyLDLt Failed to factorize matrix\n" ) , exit(1); } _eigenB.resize( M.rows() ); } @@ -362,7 +362,7 @@ class EigenSolverCholeskyLDLt : public EigenSolver< Real , MatrixRowIterator > for( int i=0 ; i( i , iter->N , iter->Value ) ); eigenM.setFromTriplets( triplets.begin() , triplets.end() ); _solver.factorize( eigenM ); - if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::update Failed to factorize matrix\n" ) , exit(0); + if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::update Failed to factorize matrix\n" ) , exit(1); } void solve( ConstPointer( Real ) b , Pointer( Real ) x ) { @@ -396,7 +396,7 @@ class EigenSolverCG : public EigenSolver< Real , MatrixRowIterator > _eigenM.setFromTriplets( triplets.begin() , triplets.end() ); _solver.compute( _eigenM ); _solver.analyzePattern( _eigenM ); - if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::EigenSolverCG Failed to factorize matrix\n" ) , exit(0); + if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::EigenSolverCG Failed to factorize matrix\n" ) , exit(1); _eigenB.resize( M.rows() ) , _eigenX.resize( M.rows() ); _solver.setMaxIterations( iters ); _solver.setTolerance( tolerance ); @@ -407,7 +407,7 @@ class EigenSolverCG : public EigenSolver< Real , MatrixRowIterator > for( int i=0 ; iN ) = iter->Value; _solver.compute( _eigenM ); _solver.analyzePattern( _eigenM ); - if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::update Failed to factorize matrix\n" ) , exit(0); + if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::update Failed to factorize matrix\n" ) , exit(1); } void setIters( int iters ){ _solver.setMaxIterations( iters ); } diff --git a/Src/MyMiscellany.h b/Src/MyMiscellany.h index 17170104..f62690ee 100644 --- a/Src/MyMiscellany.h +++ b/Src/MyMiscellany.h @@ -195,7 +195,7 @@ namespace MKExceptions void ErrorOut( const char *fileName , int line , const char *functionName , const char *format , Args ... args ) { std::cerr << MakeMessageString( "[ERROR]" , fileName , line , functionName , format , args ... ) << std::endl; - exit( 0 ); + exit( 1 ); } } #ifndef WARN @@ -324,7 +324,7 @@ inline void SignalHandler( int signal ) { printf( "Signal: %d\n" , signal ); StackTracer::Trace(); - exit( 0 ); + exit( 1 ); }; diff --git a/Src/Socket.h b/Src/Socket.h index 481297ee..320f9c3e 100644 --- a/Src/Socket.h +++ b/Src/Socket.h @@ -91,7 +91,7 @@ int socket_receive( Socket& s , Array< C > destination , size_t len ) { fprintf( stderr , "Size of socket_receive exceeds destination maximum: %zd > %zd\n" , len , destination.maximum()*sizeof( C ) ); ASSERT( 0 ); - exit( 0 ); + exit( 1 ); } return socket_receive( s , (char*)&destination[0] , len ); } @@ -102,7 +102,7 @@ int socket_send( Socket s , ConstArray< C > source , size_t len ) { fprintf( stderr , "Size of socket_send exceeds source maximum: %zd > %zd\n" , len , source.maximum()*sizeof( C ) ); ASSERT( 0 ); - exit( 0 ); + exit( 1 ); } return socket_send( s , (char*)&source[0] , len ); } diff --git a/Src/Socket.inl b/Src/Socket.inl index aee55835..53bf6855 100644 --- a/Src/Socket.inl +++ b/Src/Socket.inl @@ -86,7 +86,7 @@ void ReceiveOnSocket( Socket& s , Pointer( C ) data , size_t dataSize , const ch va_end( args ); fprintf( stderr , "\n" ); } - exit(0); + exit(1); } rec+=tmp; } @@ -101,7 +101,7 @@ void SendOnSocket( Socket& s , ConstPointer( C ) data , size_t dataSize , const if( socket_send( s , ( ConstPointer( char ) )data , dataSize )<0 ) { fprintf( stderr , "socket_send to client failed: %s\n" , LastSocketError()); - exit(0); + exit(1); } } @@ -114,7 +114,7 @@ void SendOnSocket( Socket& s , Pointer( C ) data , size_t dataSize , const char* if( socket_send( s , ( ConstPointer( char ) )data , dataSize )<0 ) { fprintf( stderr , "socket_send to client failed: %s\n" , LastSocketError()); - exit(0); + exit(1); } }