Declarations in switches, errors

Tom Karzes karzes at mfci.UUCP
Tue Oct 3 16:24:29 AEST 1989


In article <561 at crdos1.crd.ge.COM> davidsen at crdos1.UUCP (bill davidsen) writes:
-This is an error in the compilers! As ugly as this is, the ANSI standard
-(3.1.2.4) says "If an initialization is specified for the value stored
-in the object, it is performed on each normal entry, but not if the
-block is entered by a jump to a label."

Switching into a block via a switch statement clearly consitutes entering
the block by a jump to a label.  No code between the beginning of the block
and the case label should be executed, including dynamic initializations of
any automatic variables declared in the block.



More information about the Comp.std.c mailing list