I want to use throw() specifiers on some of my methods while debugging,
to help me keep track of what is going on, but remove them in release
builds. My method of doing this is
#ifdef DEBUG
#define THROW(...) throw (__VA_ARGS__)
#else
#define THROW(...)
#endif
class Foo
{
virtual void foo() const THROW (SomeException) = 0;
{
// do something
throw SomeException("Error, Will Robinson!");
}
};
However, AFAIK C++ doesn't support variadic macros (my compiler does, as
an extension). I have methods that throw up to four different exception
types; I'd rather not have to use a different macro for every possible
number of exceptions.
Within the realm of standard C++, is there a way to selectively use or
ignore throw specifiers, as described?
Rennie