Re:Don’t use C++ auto? Restricting auto is not the best deci...
by cjensen on Thursday November 09, 2017 @11:05AM
(#15663493)
That was an entirely different auto. In C89, auto just "variable on the stack". It still had a type. The new auto is just borrowing the keyword since it (a) makes sense and (b) is already a reserved word.
[ Parent
| on HN ]
Re:Don’t use C++ auto? Restricting auto is not the best deci...
by pjmlp on Thursday November 09, 2017 @11:10AM
(#15663539)
How the keyword was named when Bjarne introduced it doesn't matter, the purpose was the same as C++11 auto.
Re:Don’t use C++ auto? Restricting auto is not the best deci...
by Shorel on Thursday November 09, 2017 @12:42PM
(#15664271)
It was entirely another concept.
Before C++11 auto meant it was not static, extern or register, and in fact every single variable was already implicitly auto if no specifier from the previous list was applied.
int n = 10;
In that line, n was auto. Now it is not auto, only int.
Re:Don’t use C++ auto? Restricting auto is not the best deci...
by pjmlp on Thursday November 09, 2017 @12:48PM
(#15664312)
Type inference is orthogonal to whatever keyword is used.
Bjarne used another keyword in C with Classes, removed it due to backslash, and the commite decided to re-purpose auto for the same purpose in C++11.
No big deal, the meaning of static is also context dependent, and no one is fighting against it like it happens with the new meaning for auto.