Updating our coding conventions and coding style for C++11
David Jarvie
djarvie at kde.org
Thu Jan 16 23:47:24 GMT 2020
On Thursday 16 Jan 2020 18:46:06 Kai Uwe Broulik wrote:
> Hi,
>
> for "auto" I think we should always annotate it with const, *, and/or &
> where appropriate:
>
> auto *something = new MyCustomType;
> auto *keyEvent = static_cast<QKeyEvent *>(event);
> const auto myList = QStringList({QLatin1String("FooThing"),
> QLatin1String("BarThing")});
This is a bad example of the use of auto. It can be more simply written
without using auto:
const QStringList myList{QLatin1String("FooThing"),
QLatin1String("BarThing")};
> auto &barRef = foo[bar];
>
> > The common practice used in KDE seems to be:
> > for (a<space>:<space>b)
>
> +1
>
> Cheers
> Kai Uwe
--
David Jarvie.
KDE developer.
KAlarm author -- http://www.astrojar.org.uk/kalarm
More information about the Kde-frameworks-devel
mailing list