To be honest, I just hover my mouse over 'bar' to get the type, and I name 'bar' something more meaningful than bar. "ball_covariance", "movie_recommendations", or whatever that matrix multiplication is computing for me.
I wrung my hands when I started using 'auto' but none of the worries came to pass.
But yes, if the code is unreadable without a type, add a type. No biggie, and no one is suggesting inflexible application of rules (always use 'auto' if it is possible). The same way when I might call
foo(boo(x));
and it is not clear, I'll explicitly name the output of boo in a temporary variable:
auto robot_velocity = boo(x);
auto robot_covariance = foo(robot_velocity);
I have to say, I find the last the most unreadable. I almost never care deeply about the type, and care deeply about the meaning.
Interestingly, no one worries about typedef. typedefs wrapped around intricate collections (map of lists of dictionary of arrays) can effectively obscure what the underlying types are just as much as auto. But again, mouse hover, CTRL+I, or whatever your IDE supplies pretty much makes that a non-issue as well.
edit: the problem you are describing is due to too big a function, not 'auto'.
I wrung my hands when I started using 'auto' but none of the worries came to pass.
But yes, if the code is unreadable without a type, add a type. No biggie, and no one is suggesting inflexible application of rules (always use 'auto' if it is possible). The same way when I might call
and it is not clear, I'll explicitly name the output of boo in a temporary variable: And if that ain't enough, then sure, do this: I have to say, I find the last the most unreadable. I almost never care deeply about the type, and care deeply about the meaning.Interestingly, no one worries about typedef. typedefs wrapped around intricate collections (map of lists of dictionary of arrays) can effectively obscure what the underlying types are just as much as auto. But again, mouse hover, CTRL+I, or whatever your IDE supplies pretty much makes that a non-issue as well.
edit: the problem you are describing is due to too big a function, not 'auto'.