问题
I know that before C++11 the auto
keyword had a completely different meaning; it was a storage type specifier indicating an object that has automatic storage type (ie, placed on the stack).
That's how the theory goes... How would you actually use this keyword (syntax), and why? Also, I haven't seen this keyword in actual code pre-C++11; when was it useful (what time period)?
回答1:
It was used to declare a local variable with automatic storage duration (i.e., "on the stack").
At least since C90 it has been a useless keyword, since automatic storage duration is the default storage duration for a local variable.
来源:https://stackoverflow.com/questions/8272481/what-was-auto-used-for-before