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


On Sat, 2010-10-30 at 22:23 +0200, Gert Faller wrote:
Hi,

here are some more of them.

Great, thanks. 

Looking at this createFromAscii_4.patch reminds me of something else.
Nothing to do with you, the code was this way already, but 

rtl::OUString foo = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("apple"));
is rather unnecessarily verbose 
rtl::OUString foo(RTL_CONSTASCII_USTRINGPARAM("apple"));
is far easier on the eye and is equivalent.

Looking at createFromAscii_2.patch I see it affects a ternary operator
(i.e. ?:) so..

#define RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) constAsciiStr,
((sal_Int32)(sizeof(constAsciiStr)-1)), RTL_TEXTENCODING_ASCII_US

old: OUString sFoo(OUString::createFromAscii(bBool ? "true" : "false));

new: OUString sFoo(RTL_CONSTASCII_USTRINGPARAM(bBool ? "true" :
"false));

would be expanded as...

OUString sFoo(bBool ? "true" : "false, ((sal_Int32)(sizeof(bBool ?
"true" : "false)-1));

I think this is fine, but I'm a little bit wary of making that change
while sleep-deprived given the occasional gotchas messing with ternary
operators can have, e.g.
http://blogs.linux.ie/caolan/2009/04/15/ternary-operator-blues/
so everything pushed except that I've omitted createFromAscii_2.patch
for now.

C.


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.