Path: utzoo!attcan!uunet!ginosko!brutus.cs.uiuc.edu!psuvax1!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpclwjm!walter
From: walter@hpclwjm.HP.COM (Walter Murray)
Newsgroups: comp.std.c
Subject: Re: Declarations in switches, errors
Message-ID: <12570027@hpclwjm.HP.COM>
Date: 29 Sep 89 18:27:00 GMT
References: <561@crdos1.crd.ge.COM>
Organization: Hewlett-Packard Calif. Language Lab
Lines: 17

Concerning initialization of variables in a switch statement, please
note that the dpANS only repeats what was spelled out in the original
K&R:

   "Usually the statement that is the subject of a switch is
   compound.  Declarations may appear at the head of this statement,
   but initializations of automatic or register variables are
   ineffective."  Page 203.

And the dpANS document does suggest this as a common situation for a
warning:

   "A block with initialization of an object that has automatic
   storage duration is jumped into."  Section A.5.

Walter Murray
-------------