Converting a macro to an inline function
- by Rob
I am using some Qt code that adds a VERIFY macro that looks something like this:
#define VERIFY(cond) \
{ \
bool ok = cond; \
Q_ASSERT(ok); \
}
The code can then use it whilst being certain the condition is actually evaluated, e.g.:
Q_ASSERT(callSomeFunction()); // callSomeFunction not evaluated in release builds!…