OK, this makes absolutely no sense to me...
In release mode only, I get "warning C4702: unreachable code" on the 'throw' in the following piece of code:
if ( this->SetScore( *(rightSide.Score()) ) == false )
{
std::string strErr( "Error allocating memory in operator=() File: " );
strErr += __FILE__;
strErr += ", Line: ";
char szLine[16];
itoa( __LINE__, szLine, 10 );
strErr += szLine;
throw std::bad_alloc( strErr.c_str() ); // Warning: C4702
}
But, if I remove everything except the throw it works fine:
if ( this->SetScore( *(rightSide.Score()) ) == false )
{
throw std::bad_alloc( "test" );
}
The other way to stop the warning is to use:
#pragma optimize( "g", off )
I have another piece of code almost identical to the one's causing the error, but inside a template and there is no warning generated on those throw lines.
I can't see anything wrong Is this a bug in Visual Studio 6.0? I'm using SP5.
Thanks,
Chris.
In release mode only, I get "warning C4702: unreachable code" on the 'throw' in the following piece of code:
if ( this->SetScore( *(rightSide.Score()) ) == false )
{
std::string strErr( "Error allocating memory in operator=() File: " );
strErr += __FILE__;
strErr += ", Line: ";
char szLine[16];
itoa( __LINE__, szLine, 10 );
strErr += szLine;
throw std::bad_alloc( strErr.c_str() ); // Warning: C4702
}
But, if I remove everything except the throw it works fine:
if ( this->SetScore( *(rightSide.Score()) ) == false )
{
throw std::bad_alloc( "test" );
}
The other way to stop the warning is to use:
#pragma optimize( "g", off )
I have another piece of code almost identical to the one's causing the error, but inside a template and there is no warning generated on those throw lines.
I can't see anything wrong Is this a bug in Visual Studio 6.0? I'm using SP5.
Thanks,
Chris.