--- In [email protected], John Gaughan <[EMAIL PROTECTED]> wrote: > > John Matthews wrote: > > Yes, I know it's not good code, and I've avoided the issue and > > hopefully improved things (ie. at least made it C90 compliant) by > > enclosing the code inside the case in braces. I'm just curious. > > > > You can also separate the declaration and assignment of the variable. > For example, declare the variable outside that scope in a place such as > the start of the method or block, and assign it inside the case.
I could, but the variable is only used inside the case, so it makes sense to keep its scope to within the case only. Another approach would be to put the case code and variable inside a function and call that instead.
