[PATCH] Date picker l10n for profile and planner

Thiago Macieira thiago at macieira.org
Wed Jul 16 13:47:06 PDT 2014


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.
-- 
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



More information about the subsurface mailing list