Sign in to follow this  

exception handling in builder c++ 6

This topic is 3654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Actually what I wants that...I am upgrading a project that compiled successfully in BCC 5.02...I want to upgrade it in C++ builder 6.0..
On compiling in c++ builder 6.0 it gives error at except()...error is "catch expected"..
in this project try and except is used......
please help me

[Edited by - smdmca on December 7, 2007 1:30:15 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Ok, I'll bite. What are you doing, and more to the point why?
I imagine the question was "why are you using C++ builder at all"? Unless 6.0 is the same as C++ Builder 2007, which might make a little sense?

Share this post


Link to post
Share on other sites
Quote:
Original post by d000hg
Quote:
Original post by Evil Steve
Ok, I'll bite. What are you doing, and more to the point why?
I imagine the question was "why are you using C++ builder at all"? Unless 6.0 is the same as C++ Builder 2007, which might make a little sense?
Yup, that's what I meant.

Share this post


Link to post
Share on other sites
This is the code that I want to compile in BCB6...actuaaly this is a part of code..........

try
{

#ifdef DEBUG_SERVER_THREAD
server_thread_p3 = lastRequest;
DEBUG_SERVER( 100, 0 );
#endif

#ifdef SWITCH_CLASS_PRIORITY
// 07.16.03 - this didn't work well on EM's machine so i'm adding some switches so
// it isn't always the default behavior, She has a 900mhz P3, i have a P2 (800mhz?)
// and the slow test computer is a 166mhz P1. So what gives there???
if ( miscInfo.idleWait )
{
//const DWORD amt_wait = 500;
DWORD amt_wait = miscInfo.idleWait;
static short ctr = 0;
static short ctr2 = 0;
DWORD time1, time2, timediff, res;
time1 = GetTickCount();
res = WaitForSingleObject( hServerSema, amt_wait );
time2 = GetTickCount();
timediff = time2-time1;

if ( res == WAIT_FAILED // wait 1 second ( it doesn't return this if timeout > 1000 )
|| res == WAIT_TIMEOUT )
{
if ( !is_normal )
{
is_normal = 1;
SetPriorityClass( GetCurrentProcess(), NORMAL_PRIORITY_CLASS );
if ( miscInfo.msglev > 12 )
WriteLogf("Setting normal priority (A) %lu", timediff );
ctr = 0;
serverThrdPrty = STHRDPRTY_SLOW;
UpdateView( WINID_SESSIONS, WIS_RESUME );
}
goto wait;
}
else
{
// my initial wait was 1000 ms, res was not WAIT_FAILED or WAIT_TIMEOUT
int change = 0; // for debugging - where is the throttle flag change coming from

if ( timediff < amt_wait )
{
if ( is_normal )
{
// getting a lot of events but run slow for a while (don't hog computer)
#ifdef OLD_SLOW_IDLE_LOGIC // this doesn't work so i disabled it
if ( miscInfo.slowIdle || miscInfo.fastIdle )
{
if ( ++ctr > miscInfo.slowIdle )
change = 1;
}
else // don't throttle down while we're getting these requests within the idle wait time
#endif
{
// throttle up if we aren't there yet
change = 2;
}
}
#ifdef OLD_SLOW_IDLE_LOGIC // this doesn't work so i disabled it
// 09.09.03 ( change this to || from && ) ( allow slow idle to be zero )
else if ( miscInfo.slowIdle || miscInfo.fastIdle ) // is Idling turned on?
{
if ( ++ctr > miscInfo.fastIdle )
change = 3; // time to throttle down for a bit
}
#endif
}
else
{
// long time before something came in
if ( !is_normal )
{
// running at high speed?
change = 4; // throttle down 09.08.03
;
}
else
{
change = 5; // throttle up
}
}

if ( !change )
;
else if ( is_normal )
{
if ( throttleServerUp )
{
// run at high priority for a while then go back to normal so we
// don't hog the system either
if ( miscInfo.msglev > 12 )
WriteLogf("Setting high priority %lu c=%d", timediff, change );
if ( SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ) != 0 )
{
is_normal = 0;
ctr = 0;
serverThrdPrty = throttleServerUp;
UpdateView( WINID_SESSIONS, WIS_RESUME );
}
else
WriteLog( "SetPriorityClass() HIGH FAILED" );
throttleServerUp = 0;
}
}
else
{
if ( miscInfo.msglev > 12 )
WriteLogf("Setting normal priority %lu c=%d", timediff, change );
if ( SetPriorityClass( GetCurrentProcess(), NORMAL_PRIORITY_CLASS ) != 0 )
{
is_normal = 1;
ctr = 0;
serverThrdPrty = STHRDPRTY_SLOW;
UpdateView( WINID_SESSIONS, WIS_RESUME );
}
else
WriteLog("SetPriorityClass() NORMAL FAILED" );
}
}
}
else
WaitForSingleObject( hServerSema, INFINITE );
#else
WaitForSingleObject( hServerSema, INFINITE );
#endif

#ifdef DEBUG_SERVER_THREAD
DEBUG_SERVER( 110, 0 );
#endif


#ifdef USE_SLEEP_TICKER
if ( ++sleep_ticker >= server_sleep_threshold )
{
sleep_ticker = 0;
Sleep( server_sleep_time ); // nth of a second
}
else
#endif
#if 0 // if i activate this, it goes really slow... ( was using MS_PACKET_MAX, might be ok w/ MS_QUEUE_SIZE? )
if ( mqueue_send >= MQUEUE_THRESHOLD ) // how do i know if mirror is on? will this queue be 0 if mirror is turned off?
{
Sleep( 900 ); // give it time to catch up?
}
#endif

#if !TEST_1
if ( lastPriority == SERVER_LO_PRIORITY )
{
if ( mqueue_send < MS_PACKET_MAX )
if ( !bRebuilding )
if ( serverInfo.reflecting >= REFLECT_OFF )
lastPriority = SERVER_HI_PRIORITY;
}
else
{
lastPriority = SERVER_LO_PRIORITY;
}

SetThreadPriority( hServerThread, lastPriority );
#endif

//#ifdef DEBUG_SERVER_THREAD
//if ( miscInfo.msglev > 9 )
// WriteLog("server thread before the bProgEnd loop" );
//#endif

}//endtry
except ( 1 )
{
WriteLogf("Server Exception (A) s=%d", xstep );
}

Share this post


Link to post
Share on other sites

This topic is 3654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this