[PATCH] Date picker l10n for profile and planner

Tomaz Canabrava tcanabrava at kde.org
Wed Jul 16 14:01:08 PDT 2014


On Wed, Jul 16, 2014 at 5:47 PM, Thiago Macieira <thiago at macieira.org> wrote:
> On Wednesday 16 July 2014 15:24:28 Tomaz Canabrava wrote:
>> +QString getDateFormat();
>>
>> should be
>>
>> const QString& getDateFormat();
>>
>> because if you do QString getDateFormat(), each time that this is
>> called a copy of the QString is created to be returned, but when you
>> use the & a reference to the already - existing - variable is send
>> (much like a de-referenced pointer )
>>
>> the const is just to be safe and not modify it's contents.
>
> Please don't.
>
> The Qt style is to pass by const ref anything that isn't a primitive data type
> and to return by value. Don't return by const-ref.
>
> Sure, there are exceptions, but they are justified based on other constraints.

Ups :)
I tougth that returning by a const-ref was good, I'll change the
subsurface code that does this to follow what you said.

> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface


More information about the subsurface mailing list