On Wed, Apr 17, 2013 at 08:28:21AM +0100, Wols Lists wrote: > On 17/04/13 02:10, Lionel Elie Mamane wrote: >> On Tue, Apr 16, 2013 at 09:24:03PM +0100, Wols Lists wrote: >>> On 16/04/13 20:28, Lionel Elie Mamane wrote:
>>>> RTL_CONSTASCII_STRINGPARAM is a hack/optimisation specific to >>>> compile-time constants. With your change, the string is not anymore >>>> a compile-time constant >>> I'm puzzled that it's not a compile-time constant >> Well, it is not even a run-time constant: at each iteration of the >> loop, it is a different value. > Yes, the value passed changes each time, but the array itself is a > constant array of constant strings ... If you want to exploit that fact, you could do something like that: static std::vector< std::pair< char*, sal_Int32 > > keyword_list = boost::assign::list_of(::std::pair(RTL_CONSTASCII_STRINGPARAM( "password" ))) (::std::pair(RTL_CONSTASCII_STRINGPARAM( "user" ))) (etc) (etc) (etc).to_adapter() .... if( args[i].Name.matchIgnoreAsciiCaseAsciiL( keyword_list[j].first, keyword_list[j].second )) (or for more C++-y style, use an iterator instead of indexed access) Yes, C++03 makes this *much* harder than it could be (C++11 has a better solution: http://en.wikipedia.org/wiki/C++11#Initializer_lists ) IMHO it is *far* more trouble than it is worth. -- Lionel _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice