How does a "Variables introduce state"?
Posted
by
kunj2aan
on Programmers
See other posts from Programmers
or by kunj2aan
Published on 2012-09-26T17:09:17Z
Indexed on
2012/09/27
3:48 UTC
Read the original article
Hit count: 302
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?
© Programmers or respective owner