pa**********@att.net wrote:
On Nov 5, 4:37 pm, Ian Collins <ian-n...@hotmail.comwrote:
>pauldepst...@att.net wrote:
>>Is there any standard c++ command for halting execution?
abort()?
--
Ian Collins.
Thanks.
I was using assert statements before I decided debug mode was just too
slow and to try other approaches. However, having tried both abort()
and assert(false) on the vc++ compiler, I've noticed that assert is
much more helpful -- in particular it gives the precise linenumber of
the crash.
I know it's probably a compiler-dependent question but is there a way
of getting a line number with abort().
This is how I check errors in my opengl programs:
void checkOpenGlError( const unsigned int lineNo )
{
const GLenum err ( glGetError( ) );
if ( GL_NO_ERROR != err )
{
std::cerr << "OpenGl error : " << lineNo << " "
<< gluErrorString( err ) << std::endl;
exit( EXIT_FAILURE );
}
}
Then when I want to check the error, I call like this:
checkOpenGlError( __LINE__ );
Therefore, instead of exiting with abort(), or assert(false), you can
implement something similar.