Is there any reason to use the 'auto' keyword in C++03?

后端 未结 10 1771
[愿得一人]
[愿得一人] 2020-11-28 02:27

Note this question was originally posted in 2009, before C++11 was ratified and before the meaning of the auto keyword was drast

10条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 03:17

    The auto keyword has no purpose at the moment. You're exactly right that it just restates the default storage class of a local variable, the really useful alternative being static.

    It has a brand new meaning in C++0x. That gives you some idea of just how useless it was!

提交回复
热议问题