How does a "Variables introduce state"?
- by kunj2aan
I was reading the "C++ Coding Standards" and this line was there:
Variables introduce state, and you should have to deal with as little state as possible, with lifetimes as short as possible.
Doesn't anything that mutates eventually manipulate state? What does "you should have to deal with little state as possible" mean?
In an impure language such as C++, isn't state management really what you are doing? And what are other ways to "deal with as little state as possible" other than limiting variable lifetime?