3 ms·
The issue is that 'var' would make old code not compile anymore, while 'auto' was already a keyword with pretty much no use.
by nightcracker 9y ago
The issue is that 'var' would make old code not compile anymore, while 'auto' was already a keyword with pretty much no use.
- monocasa 9y agoExactly; 'auto' was the corollary of 'register'. Ie. it specified that the variable was to be put into automatic storage. On most architectures this means the stack. So not only did it specify what was the default behavior anyway, but it's better to let the compiler figure that out too.
- Koshkin 9y agoThe change of the meaning of 'auto' already broke the old code. In C, 'auto' is used to specify a storage class; in C++, it stands for the type. So, the valid C code auto float x; when compiled with a C++ compiler, produces an error message.
- beojan 9y agoIf we're talking about actual C++ code, auto is a reserved keyword (so it wouldn't be used as an identifier) but it was useless, so it wouldn't be used as a keyword in any real (C++) code.
- TheCoelacanth 9y agoThat was virtually never used in the wild, though.