[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: Updating our coding conventions and coding style for C++11
From:       David Faure <faure () kde ! org>
Date:       2020-01-16 22:27:57
Message-ID: 9025183.ag9G3TJQzC () asterixp50
[Download RAW message or body]

On jeudi 16 janvier 2020 18:29:11 CET Vlad Zahorodnii wrote:
> I would like us to copy Qt's policy [1] for consistency:

OK, please do.

> for (a<space>:<space>b)

+1

Kai-Uwe wrote:
> 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);

Well, the * is completely redundant in those cases, so it doesn't bring anything.
I'd be tempted to say, let's not require it.
But then it raises the question of consistency (without a guideline, we'll have some \
places with * and some places without *).

From Qt:
examples/widgets/gallery/widgetgallery.cpp:272:    auto toolMenu = new \
QMenu(menuToolButton); tests/manual/cocoa/menurama/main.cpp:40:    auto *dockMenu = \
new QMenu(); Personally, I can survive with this small discrepancy, just like the Qt \
developers clearly can as well. But if everyone feels strongly that we need to \
standardize on something....

> const auto myList = QStringList({QLatin1String("FooThing"), \
> QLatin1String("BarThing")}); auto &barRef = foo[bar];

I agree about those, they are not redundant.

-- 
David Faure, faure@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic