7 ms·
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) mak
by cjensen 9y ago
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.
- pjmlp 9y agoHow the keyword was named when Bjarne introduced it doesn't matter, the purpose was the same as C++11 auto.
- Shorel 9y agoIt 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.
- pjmlp 9y agoType 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.