Is there any other meaning for "auto" than "local variable"?
Not in C ++ 03.
Everything that he does is implicitly done for you, wherever you want to use it?
Nothing in C ++ 03.
How does an automatic variable behave in a program area? What of a static automatic variable in a file area?
The keyword is not allowed outside the function / method body.
Does this keyword have any purpose [in C ++ 03] different from the existing one for completeness?
Amazing yes. C ++ design criteria included a high degree of backward compatibility with C. C having this keyword, and there was no real reason to prohibit it or override its value in C ++. Thus, the goal was one less incompatibility with C.
Does this keyword have any purpose in C other than the existing one for completeness?
I only found out about this recently: the ease of porting old programs from B. C evolved from B, whose syntax was very similar to C. However, B had no types. The only way to declare a variable in B is to specify your storage type ( auto or extern ). Like this:
auto i;
This syntax still works in C and is equivalent
int i;
since in C, the storage class defaults to auto and defaults to int . I assume that every single program that originated in B and was ported to C was literally filled with auto variables at that time.
C ++ 03 no longer allows implicit C-style ints, but it retained the auto keyword, which did not contain more time, because, unlike implicit ints, it was not known that it caused any problems in the C syntax.
Jirka Hanika Sep 30 '15 at 16:45 2015-09-30 16:45
source share