[Qt-creator] Using C++11 in Creator's source

Daniel Teske daniel.teske at digia.com
Fri Mar 7 12:53:54 CET 2014

> So, I put this concrete rule up for discussion:
> Optionally you can use the “auto” keyword in the following cases. If in
> doubt, if auto could make the code less readable, do not use auto. Keep in
> mind that code is read much more often than written.
> * When it avoids repetition of a type in the same statement. You should
> explicitly mention any “const”, “&” and “*” as well, even if they were
> implicit. - auto *something = new MyCustomType(…);
>    - auto *somethingElse = qobject_cast<MyOtherCustomType *>(sender());
>    - auto myFunnyListOfThings = QStringList() << QLatin1String(“FooThing”)
> << QLatin1String(“BarThing”);
> * When assigning iterator types.
>    - auto it = myFunnyListOfThings.const_iterator();
I think we should stop the discussion about auto now, and simply go with those 
rules. They are fairly conservative and we can extend them later.

So: +1


More information about the Qt-creator mailing list