What was `auto` used for before?

百般思念 提交于 2019-12-22 04:39:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!