In the C programming language, it is my understanding that variables can only be defined at the beginning of a code block, and the variable will have the scope of the block it was declared in. With that in mind, I was wondering whether it is considered bad practice to artificially create a new scope as in this example:
void foo()
{
... Do some stuff ...
if(TRUE)
{
char a;
int b;
... Do some more stuff ...
}
... Do even more stuff ...
}
Assuming TRUE is set to 1 in a macro definition, would this code be considered 'good code' or does it make seasoned programmers cringe at the very thought of it?
Thanks for your input!
EDIT: In response to some of the answers, the code I am working with needs to work with some pretty ancient legacy systems. While it would be nice to operate on an assumption of C99, we really can't guarantee that they will have it.