Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!smurf!nadia!ananke!kaiser From: kaiser@ananke.stgt.sub.org (Andreas Kaiser) Newsgroups: comp.lang.c++ Subject: conditional scope and destructors results Message-ID: <9.27443595@ananke.stgt.sub.org> Date: 16 Nov 90 18:38:19 GMT Organization: Ananke, Stuttgart, FRG Lines: 32 In your msg to All, dated <16 Nov 90 19:01>, it said: PM> Tnaks to Reid Ellis for the test prog that showed that it is probably PM> a bug in the zortech compiler. His test prog was (paraphrased) PM> This works fine - i tryed on my compiler. So I went back to my code PM> and found that I had oversimplified to example - changing the above to PM> func() PM> { PM> ..... PM> if (i==0) PM> goto err_exit; PM> foo bar; PM> err_exit:; PM> return 0; PM> } PM> now fails - ie the constructor is not called but the destructor is. PM> I'm sure this proves that it is a bug in the zortech compiler since PM> the behaviuor must be consistent. ARM, page 91: "It is illegal to jump past a declaration with an explicit or implicit initializer unless the declaration is in an inner block that is not entered (...) or unless the jump is from a point where the variable has already been initialized." Andreas -- :::::::::::::::::::: uucp: kaiser@ananke.stgt.sub.org :: Andreas Kaiser :: fido: 2:509/5.2512 & 2:507/18.7206 ::::::::::::::::::::