Listing 1

#include <stdio.h>
#include <string>
#include <exception>
// encode "where" info into standard exception
void Throw(char const* file, int line) 
{  char buf[500];

   sprintf(buf,"%s(%d)", file, line);
   throw std::logic_error(std::basic_string<char>(buf));
}