samedi 6 août 2016

How to print the #define statement?

How can I get cerr to print 5 < 6 as opposed to statement_? I have access to Boost and Qt.

using namespace std;

#define some_func( statement_ )               
  if( ! statement_ )                          
  {                                           
    throw runtime_error( "statement_" );      
  }                                           

int main()
{
  try
  {
    some_func( 5 < 6 );
  }
  catch(std::exception& e)
  {
    cerr << e.what();
  }
}

Aucun commentaire:

Enregistrer un commentaire