RTL_CONSTASCII_(U)STRINGPARAM officially obsolete

Noel Grandin noel at peralex.com
Thu Apr 5 05:52:41 PDT 2012


On 2012-04-05 14:47, Caolán McNamara wrote:
> Cause I worry that someone's going to end up comparing string literals
> to each other under some conversion like
>
> -#define FOO rtl::OUString(..."foo"...)
> +#define FOO "foo"
> -#define BAR rtl::OUString(..."bar"...)
> +#define BAR "bar"
>
> if (FOO == BAR)

You could solve that with some tainting.
So you have a boolean flag inside an OUString that says "I was created 
from a literal".
Then you check in the equality operator if the other side also has the 
flag, and if so, complain loudly.

Obviously this needs to be under some kind of DEBUG symbol.


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




More information about the LibreOffice mailing list