[Libreoffice] OSL_ASSERT - remove backtrace or make abort
tlillqvist at novell.com
Thu Apr 21 07:18:43 PDT 2011
I just a moment ago came across a nice example how confusing and unclear the use of the various kinds of assertions can be.
See unotools/source/config/searchopt.cxx , sal_Bool SvtSearchOptions_Impl::Load():
const Any &rVal = pValues[i];
DBG_ASSERT( rVal.hasValue(), "property value missing" );
So it apparently is a bad thing if rVal has no value? The code continues:
OK, so the code is prepared to handle it anyway, if there is no value, it doesn't attempt to do any bad things. So it can't be that bad that the value is missing? The if block eventually ends with:
OSL_FAIL( "value missing" );
OK, so it is bad after all that the value was missing, but bad in a different way this time, not in the DBG_ASSERT() way but in the OSL_FAIL() way. Is that more or less bad?
bSucc = sal_False;
But it still is prepared to handle this by just returning a boolean return value indicating failure.
Gack. I can't make any sense out of this.
More information about the LibreOffice