Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!alberta!calgary!cpsc!jsimellon From: jsimellon@cpsc.ucalgary.ca (Larry Mellon) Newsgroups: comp.lang.c++ Subject: AT&T 1.2.1 bug Keywords: dtors, switch statements Message-ID: <1254@cs-spool.calgary.UUCP> Date: 5 May 89 07:42:29 GMT Sender: news@calgary.UUCP Lines: 36 Cfront 1.2.1 does not handle the declaration of data_types within switch statements correctly, if the data_type has a destructor. Example: /**** start code fragment ***/ case 0: { sim_event ev; // line N // code break; } case 1: /*** end code fragment */ This produces the warning message from cc: "ex.c", line N: warning: statement not reached What happens is cfront inserts a dtor call for 'ev' before the 'break' statement to ensure the dtor is called before leaving the block. Another dtor call seems to be inserted by default at the end of the block, *after* the unconditional 'break' statement. "So don't open blocks inside of switch statements." you say. Please see previous posting re: cfront bug requiring you to open blocks inside of switch statements. It's only a warning; I could live with it. But when we ship our software out, I'm not looking forward to explaining this to every user... We're looking at porting our software to other versions of C++. Can anyone please tell me if your flavour of C++ handles switch statements better, or if cfront 2.0 fixes this? Larry Mellon Jade Simulations International (403) 282-5711