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

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Dec 29 18:39:58 CET 2015


On 2015-12-24 19:16, Kevin Kofler wrote:
> Matthew Woehlke wrote:
>>   auto result = QString{a + b};
> 
> IMHO, that's just a complicated and ugly way to write:
>   QString result = a + b;
> 
> There is no way the variable can be uninitialized if you initialize it right 
> there in the declaration.

That's nice, but what about when you forget to initialize something? If
you (almost) always use auto, the compiler will squawk. The benefit
comes from *consistency*.

Anyway, I'm not trying to argue passionately that Qt should follow AAA.
I'm just saying that it's incorrect to state that you have to deviate
from AAA because it might give you the wrong type. (And, as Marc notes,
AAA, used correctly, actually *better* documents code in such case.)

-- 
Matthew




More information about the Development mailing list