Another Opinion on “Almost Always Auto”
Herb Sutter has been promoting his almost always auto style again, and I think it is harmful. I would agree with “almost always auto” in Scala. I disagree with it in C++. And that’s because there is a slight difference in syntax for type inference between the two languages.
Here’s type deduction in Scala:
val inferred = 0 val typed : Int = 1
And here it is in C++
auto inferred = 0; int typed = 1;
Seems similar, right? But the difference in syntax leads to different long term programmer behavior.