what is the point of the IMPL_RTL_STRINGNAME macro?

Noel Grandin noel at peralex.com
Thu Oct 31 10:17:08 CET 2013


On 2013-10-31 10:58, Stephan Bergmann wrote:
> On 10/31/2013 09:46 AM, Noel Grandin wrote:
>> There are some odd macros here:
>>
>> http://opengrok.libreoffice.org/xref/core/sal/rtl/string.cxx#58
>>
>> which look like:
>>
>>       #define IMPL_RTL_STRINGNAME( n )    rtl_string_ ## n
>>
>> and then they are used in the code like this:
>>
>>      IMPL_RTL_STRINGNAME( release )( *pTarget );
>>
>> and in methods definitions like this:
>>
>>      static IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )(
>> sal_Int32 nLen )
>>
>>
>> I'm not seeing the points of these macros?
>> They make the methods in questions invisible to OpenGrok and grep and
>> they don't seem to add any value.
>
> Those IMPL_RTL_* macros are for use in the #include "strtmpl.cxx" a few lines further down.  Sort of poor man's 
> templates, to do code sharing among string.cxx and ustring.cxx.
>
> Uses of the macros directly in string.cxx could be resolved, of course.
>


Ah, that makes more sense. I'll add a comment in the code to that effect for the next confused newbie :-)


Disclaimer: http://www.peralex.com/disclaimer.html




More information about the LibreOffice mailing list