| 1 |
// define X to activate the xerr/xerr2 macros: |
| 2 |
// xerr(insertion) |
| 3 |
// inserts the '<<' concatenated elements into std::cerr |
| 4 |
// preceded by the name of the source file, and ended by '\n' |
| 5 |
// xerr2(insertion, code) |
| 6 |
// performs the insertion if X is defined, and (unconditionally) |
| 7 |
// executes the statement(s) in `code'. `code' must be valid |
| 8 |
// C(++) code. |
| 9 |
// |
| 10 |
#ifdef XERR |
| 11 |
#include <iostream> |
| 12 |
#define xerr(insertion) std::cerr << __FILE__": " << insertion << '\n' |
| 13 |
#define xerr2(insertion, b) \ |
| 14 |
{ std::cerr << __FILE__": " << insertion << '\n'; b; } |
| 15 |
#else |
| 16 |
#define xerr(insertion) |
| 17 |
#define xerr2(insertion, b) b |
| 18 |
#endif |