← Back to team overview

kicad-developers team mailing list archive

"auto" policy


Do we have a policy on when to use auto?

Personally, I like it when it removes repetition.  For instance:

    auto pin = new SCH_PIN();  

And I like it when it removes stupid template things like std::pair<>:

    for( auto it : my_unordered_map )

But I don’t like it in other cases.  This reduces readability for me:

    auto pos = pin->GetPosition();

However, I’m just one voice, and the idea of when something is a “stupid template thing” and when it isn’t is admittedly pretty ill-defined.

How do others feel?


Follow ups