Goal of C's “auto” keyword

前端 未结 5 639
小蘑菇
小蘑菇 2021-01-07 20:17

What is the goal of the \"auto\" keyword in C? With C++ 0x it got new meaning but does it mean that my code will break if I port C code over to a C++ 0x compiler?

5条回答
  •  离开以前
    2021-01-07 21:08

    Bjarne Stroustrup mentions in his C++0x FAQ about auto:

    "The old meaning of auto ("this is a local variable") is redundant and unused. Several committee members trawled through millions of lines of code finding only a handful of uses -- and most of those were in test suites or appeared to be bugs."

    So I assume, that compilers wil not be forced by the standard to implement the old meaning of auto.

提交回复
热议问题