??? 02/10/09 17:48 Read: times |
#162255 - Improved scope Responding to: ???'s previous message |
Block-local variables can help greatly when reading the code. Having the variable names in direct relation to the code that makes use of them makes it easier to keep track of their datatypes, and to assert that you don't have to scan other parts of the code for unexpected changes or use of them. This makes it easier to change the code without worrying about bad side effects of the changes.
I sometimes creates unconditional blocks (not part of if, for, while, do, ...) just to get a new anonymous namespace for one or more local variables. |