Question about calling a method with a default parameter

Christophe JAILLET christophe.jaillet at wanadoo.fr
Sun Jul 8 05:46:00 PDT 2012


Hi,

Sometimes some methods are declared with some default value(s)
As an example, here is the definition of matchAsciiL for OUString
 >>>>>
     sal_Bool matchAsciiL( const sal_Char* asciiStr, sal_Int32 
asciiStrLength, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
 >>>>>


When these functions are called, the optional parameters are sometimes 
passed with the default values.
As an example, at line 60 of 
/framework/source/lomenubar/MenuItemStatusListener.cxx, we can find :
 >>>>>>>
     if ((Event.State >>= oULabel) &&
         !oULabel.matchAsciiL ("private:", 8, 0) &&
         !oULabel.matchAsciiL (".uno:", 5, 0)    &&
         !oULabel.matchAsciiL ("slot:", 5, 0)    &&
         !oULabel.matchAsciiL ("service:", 8, 0) &&
         !oULabel.matchAsciiL (".cmd:", 5, 0)    &&
         !oULabel.matchAsciiL ("macro:///", 5, 0))
 >>>>>>>

Would it be interesting to lightweight the code by removing these 
useless parameters ?
It could be a Easy Hacks for Beginners


Best regards
Christophe JAILLET



More information about the LibreOffice mailing list