Declarations in switches, errors

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Sep 28 11:55:28 AEST 1989


In article <561 at crdos1.crd.ge.COM> davidsen at crdos1.UUCP (bill davidsen) writes:
>I submit that executing a switch statement constitutes "normal entry"
>and that the initialization should be performed before evaluating the
>switch variable. Would any of the people still on X3J11 like to comment?

No, the block is the controlled part of the switch and it is entered
via a case or default label, not sequentially starting at the block
beginning.  Declarations before the first label are valid, but no
auto initialization is performed since execution does not "plow
through" the declarations but instead bypasses them.

The above is my understanding of what is supposed to be going on in
a switch statement; my X3J11 notes are elsewhere at the moment.



More information about the Comp.std.c mailing list