Frank Schönheit - Sun Microsystems Germany wrote:
Hi Stephan,
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 ;) ).
I admit I do not like this pattern, since it always leaves me with the
gut feeling that there's unnecessary code left with OSL_DEBUG_LEVEL ==
0. I.e., a dumb compiler might compile this to the equivalent of
if ( !callSomeFooWhichSignalsSuccess( bar ) )
;
instead of
callSomeFooWhichSignalsSuccess( bar )
Yes, nowadays compilers probably aren't that dumb, so I would probably
just educate myself to not stumble upon this pattern anymore ... :)
At OSL_DEBUG_LEVEL == 0,
OSL_VERIFY(callFoo(bar) == good);
is just
((void)(callFoo(bar) == good);
which you also trust the compiler to simplify. Just trust the compiler
to do its job.
Ciao
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]