I believe that auto has been redefined in C++11 as well. In both, all it really
means is that the type is inferred.

That's what I seemed to remember as well. Originally it had something to do with scope, but it was basically obsolete because that was the default storage class anyway, so nobody was using it.

In the latest iteration of C++ they decided to redefine the keyword to mean automatic type inference. This avoided having to introduce a new keyword (which could break existing code that happened to use that word for a variable name) and it was unlikely to cause problems with old code. Storage class for local variables is still the same default anyway.

(The only possible error could be if someone wrote "auto a = b" as shorthand for "auto int a = b" with b some type other than int, which would have been legal in very old versions of C but extremely unlikely to ever be used since auto does nothing for an int)

Reply via email to