Frank Schönheit - Sun Microsystems Germany wrote:
Hi Kay,
Sorry for the (may be stupid) question, but why not just change
OSL_VERIFY to emit nothing, in case OSL_DEBUG_LEVEL == 0? I would expect
that only weird code would relay on the evaluation in case of a zero
debug level.
Why "weird"? The alternative is something like
#if OSL_DEBUG_LEVEL > 0
bool result =
#endif
callSomeFooWhichSignalsSuccess( bar );
OSL_ENSURE( result, "this was expected to succeed!" );
I definately think that
OSL_VERIFY( callSomeFooWhichSignalsSuccess( bar ) );
is the better (non-weird) alternative here.
And these case can probably easily be changed to something
with "assert" (or ensure).
Please show me the easy (!) replacement of the above OSL_VERIFY :)
Or did I completely misunderstand you and you only suggested to replace
the occurences of OSL_VERIFY( a == b )?
As I wrote before, I think
if (!callSomeFooWhichSignalsSuccess(bar)) {
OSL_ENSURE(false, "this was expected to succeed!");
}
is the better alternative to the OSL_VERIFY above, as it does not
violate the Principle of Least Surprise (and helps get rid of a spurious
warning ;) ).
-Stephan
And when we are on it, what are the differences / purposes between
- OSL_VERIFY
- OSL_ENSURE
- OSL_ASSERT
? Couldn't we consolidate to just _one_ macro. E.g. OSL_ENSURE because
of the passed message?
Oh, while we're at it, let me throw in one of my favourites: Shouldn't
we consolidate the DBG_* and OSL_* diagnostics macros?
Ciao
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]