I
Immortal Nephi
I am unable to find good documentation which talks about debug
macro. The exception may be used for testing purpose.
/* C Code */
void foo( int x )
{
#if _DEBUG
if( x > 10 )
std::cerr << “x value must not be greater than 10.” << std::endl;
#endif // _DEBUG
// Run normal execution
}
/* C++ Code */
static const bool TESTING = true;
void foo( int x )
{
if( TESTING )
if( x > 10 )
std::cerr << “x value must not be greater than 10.” << std::endl;
// Run normal execution
}
C++ Compiler has the _DEBUG option. _DEBUG option is turned off if
release mode is active and any _DEBUG macro blocks are ignored. I
have no idea how C++ does not use _DEBUG macro. I wonder that TESTING
condition will be removed if optimization is turned on when release
mode is active.
Please tell me more how cerr and clog are useful. I do not want to
see error messages in the console window. I want to see error message
in window dialog when Microsoft Visual C++ .NET 9.0 triggers assertion
request.
I may not need exception because step by step debugging procedure is
simpler than throw, try, and catch keywords.
/* C++ Code */
static const bool TESTING = true;
void foo( int x )
{
if( TESTING )
if( x > 10 )
std::_DEBUG_ERROR("x value must not be greater than 10.\n");
// Run normal execution
}
macro. The exception may be used for testing purpose.
/* C Code */
void foo( int x )
{
#if _DEBUG
if( x > 10 )
std::cerr << “x value must not be greater than 10.” << std::endl;
#endif // _DEBUG
// Run normal execution
}
/* C++ Code */
static const bool TESTING = true;
void foo( int x )
{
if( TESTING )
if( x > 10 )
std::cerr << “x value must not be greater than 10.” << std::endl;
// Run normal execution
}
C++ Compiler has the _DEBUG option. _DEBUG option is turned off if
release mode is active and any _DEBUG macro blocks are ignored. I
have no idea how C++ does not use _DEBUG macro. I wonder that TESTING
condition will be removed if optimization is turned on when release
mode is active.
Please tell me more how cerr and clog are useful. I do not want to
see error messages in the console window. I want to see error message
in window dialog when Microsoft Visual C++ .NET 9.0 triggers assertion
request.
I may not need exception because step by step debugging procedure is
simpler than throw, try, and catch keywords.
/* C++ Code */
static const bool TESTING = true;
void foo( int x )
{
if( TESTING )
if( x > 10 )
std::_DEBUG_ERROR("x value must not be greater than 10.\n");
// Run normal execution
}