Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfclp!jenings From: jenings@hpfclp.SDE.HP.COM (Byron T. Jenings Jr.) Newsgroups: comp.lang.c++ Subject: Re: Another question... Message-ID: <7180003@hpfclp.SDE.HP.COM> Date: 5 Sep 89 22:35:59 GMT References: <42968@bbn.COM> Organization: HP SESD, Fort Collins, CO Lines: 18 |/ hpfclp:comp.lang.c++ / gww@bbn.com (George Williams) / 12:18 pm Aug 15, 1989 / |7) What is the scope of (and when do destructors get called on:) | switch(i) { | case 1: | String q(10); | case 2: | String j(10); | default: | String k(10); | } The easiest way to think of this is that the labels in a case statement are just like any other C label, and {} blocks are the same as any other block. You can think of the "switch" as expanding into a bunch of "if (i == XXX) then goto XXX;" statements. This means that the scope of each variable extends from the declaration down to the closing curly, as usual.