Is there a downside to declaring variables with auto in C++?

后端 未结 14 2080
-上瘾入骨i
-上瘾入骨i 2020-12-12 18:14

It seems that auto was a fairly significant feature to be added in C++11 that seems to follow a lot of the newer languages. As with a language like Python, I ha

14条回答
  •  臣服心动
    2020-12-12 18:37

    It makes your code a little harder, or tedious, to read. Imagine something like that:

    auto output = doSomethingWithData(variables);
    

    Now, to figure out the type of output, you'd have to track down signature of doSomethingWithData function.

提交回复
热议问题