In article , �amonn McManus wrote: >with the exciting new feature you can write: > switch (thing) { > case one: > int x = whatever(); > use(x); > break; > case two: > int x = maybe(); > use(x); > break; > } >Except I very much hope that you can't, since that would be a multiple >declaration of x. I think you are correct. >Presumably the new C will allow the first >declaration but require the `int' to be left off the second, turning >it back into a lowly statement. Yes. >That's terrible programming practice of >course because you're having the meaning of one switch case depend on >the way another one was written. So, what you might do is switch (thing) { int x; case one: ... } and, of course, you can't count on x being initialized, because you'll be jumping in past the initializer. >Nonetheless the new C feature is easy to implement and understand and is >fairly often useful. That's my reading of it. I still slightly prefer blocks, so I can clearly end the scope of a declaration, but that's just a matter of personal style. -s -- seebs@plethora.net -- Speaking for myself. No spam please. Copyright 1997. All rights reserved. This was not written by my cat. C/Unix wizard - send mail for help! -- - More Net, Less Spam!