Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!uakari.primate.wisc.edu!ginosko!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.std.c Subject: Re: Declarations in switches, errors Message-ID: <637@crdos1.crd.ge.COM> Date: 29 Sep 89 14:54:31 GMT References: <561@crdos1.crd.ge.COM> <11158@smoke.BRL.MIL> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 21 I guess my main thought on declarations at the start of a switch is that anything which is allowed (ie. legal C) should work. It would probably take less effort to make it work than to add error checking code, from a compiler standpoint. It a feature with limited use even if it did work, but I am bothered by anything I can write which is legal but may not work the same way on all implementations. Perhaps a little matter for the next committee would be to either say "initialization of variables declared at the start of a switch is not allowed" or "variables declared at the beginning of a switch are initialized before the control expression is evaluated, even if no cases are matched." I have no strong feelings about whether it should or shouldn't work, but it should be predictable. That's what standards are all about, right? -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon