Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


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:

            if (rVal.hasValue())
            {

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:

            }
            else
            {
                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.

--tml



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.