A
Andy Fish
Hi,
Often when I introduce a new variable declaration in the middle of a block
it is just for temporary purposes, so I would like that variable to go out
of scope when I'm done with it, rather than staying in scope until the end
of the function.
A trick I have occasionally used is to include an artificial inner block
e.g.
....
{
int workingValue=0;
...
}
// now I know workingValue has gone out of scope
do you folks think this is a viable programming practice, or does the
apparently superfluous level of nesting just serve to hamper readability and
confuse people?
Andy
Often when I introduce a new variable declaration in the middle of a block
it is just for temporary purposes, so I would like that variable to go out
of scope when I'm done with it, rather than staying in scope until the end
of the function.
A trick I have occasionally used is to include an artificial inner block
e.g.
....
{
int workingValue=0;
...
}
// now I know workingValue has gone out of scope
do you folks think this is a viable programming practice, or does the
apparently superfluous level of nesting just serve to hamper readability and
confuse people?
Andy