[Development] RFC: more liberal 'auto' rules?

Marc Mutz marc.mutz at kdab.com
Wed Dec 9 15:54:06 CET 2015

On Wednesday 09 December 2015 13:18:06 Knoll Lars wrote:
> as a listing with 50 entries won’t help anybody.

Indeed. Therefore the suggestion to opt into C++ features, but optiing out of 
specific use cases. We have no indication that any compiler has problems with 
auto variables, so I don't see a reason for the Coding Style to restrict their 

We don't restrict the use of other C++ feature, such as do-while loops, 
either, even though they're inherently unreadable. Why do we need detailed, 
point-by-point rules micromanging the use of auto?

The problem with codifying what isn't codifiable (due to lack of consensus in 
the wider C++ community) is that it will set in stone something that should 
grow as understanding grows. Some people are scared of auto, other (_not_ me, 
in case that wasn't clear) want to go to the other extreme: AAA-style. 
Codifying any two of the positions is wrong. Picking something in-between is 
something for people with a crystal ball.

We should _require_ a small set of use-cases, for code consistency, and leave 
the rest for comments in reviews. That only works, of course, if people don't 
start running around -2'ing code just because they think there are too many or 
too few autos in there. It should be the prerogative of the patch author to 
decide, as she's the one doing the work. It's as subjective as variable 
naming, and we also only have very broad guidelines for that.

> Are these cases something we can agree upon?

Too little, imho. If we continue at this speed (one week for 1.5 more use-
cases of an already-allowed feature), then we're going to be done with C++11 
when C++22 is out.

It's ok to discuss things, but discussions on this mailing-list tend to be 
fruitless (there's no conclusion to Thiago's thread "Upgrading the source..." 
from January 2015), tend to be hijacked by people over and over again who are 
"against" every change, the OP getting side-tracked into offside discussions 
(his fault! :), and discouragement for all sides involved.

Please just _decide_. I, for one, pledge to live with the outcome. You heard 
all the arguments. Let's get it over with, and start over with nullptr :) For 
5.8, we can re-open the discussion for auto variables.


Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts

More information about the Development mailing list