473,472 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

aborting execution

Is there any standard c++ command for halting execution? The nearest
equivalent I can find is assert(false); However this only works in
debug mode.

I'm trying to examine the execution flow of my program but an issue is
that debug mode is enormously slow, so setting breakpoints is
enormously slow. For speed, I want to do as much as possible in
release mode.

It occurs to me that, if I knew a c++ command for halting execution, I
could see which line was being executed while in release mode.

Paul Epstein

Nov 5 '07 #1
5 2288
pa**********@att.net wrote:
Is there any standard c++ command for halting execution?
abort()?

--
Ian Collins.
Nov 5 '07 #2
Ian Collins wrote:
pa**********@att.net wrote:
>Is there any standard c++ command for halting execution?

abort()?
or exit(status)
Nov 5 '07 #3
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().

Paul Epstein

Nov 5 '07 #4
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.
Nov 5 '07 #5
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().
Call it with assert? Why not just enable asserts in you application?
Asserts and optimisation are orthogonal, so you can have one without the
other, just don't define NDEBUG.

--
Ian Collins.
Nov 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: 11abacus | last post by:
Hi all, I wonder if this is possible: I have a script that does things that take time. In the first part of the script it does data checking and other verifications, then comes the long part. I...
0
by: Jason | last post by:
I have a job created on my server which runs a stored procedure. The SP uses a cursor on a recordset to insert rows into a table (via a stored procedure - hence the cursor). It is expected that...
6
by: Mike Brown | last post by:
Hello I am calling a stored procedure in a MSDE/SQLServer DB form within my Visual C++ 6.0 program along the lines CCommand<CAccessor<CdboMyAccessor>>::Open(m_session, NULL); With...
1
by: siva sanks | last post by:
Hello, I have a situation, in which, we would be calling the external interfaces from our application. For some reason, the external interface call doesnt produce any time outs and it hangs for...
1
by: Gomaw Beoyr | last post by:
When the BeginInvoke method of a delegate is called, the execution of the delegate is in another thread. (I'm not sure if an entirely new thread is created, or if a "sleeping" thread is used.) ...
1
by: johnny | last post by:
In a multi-threaded application, say a worker thread makes an asynchronous call and specifies a callback method. But before the callback is executed, the thread is aborted by its creator. What is...
2
by: Marc Scheuner [MVP ADSI] | last post by:
Folks, I have a plug-in system where I have a host that creates child forms to be displayed (in an MDI manner). One requirement is that if certain conditions apply, a child form should not be...
1
by: Chris Morse | last post by:
WARNING: Verbosity: skip to the very bottom paragraph for succinct version of my question.) Hi- I can't seem to find an answer to this. I am playing around with a variation of the ".NET...
7
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.