Xref: news2.mv.net comp.os.msdos.djgpp:998 From: lupus AT tasha DOT dei DOT unipd DOT it (Molaro Paolo 338814/C (addetto)) Newsgroups: comp.os.msdos.djgpp Subject: Re: v2 vs v1 C++ interpretation Date: 31 Jan 1996 15:17:29 GMT Organization: D.E.I - Universita' di Padova, Italia Lines: 45 Message-ID: <4eo169$5uo@maya.dei.unipd.it> References: <4eads7$4e6 AT trog DOT dra DOT hmg DOT gb> NNTP-Posting-Host: tasha.dei.unipd.it To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4eads7$4e6 AT trog DOT dra DOT hmg DOT gb>, wrote: >void term() >{ > switch (curr_tok) > { > case 1: > double d = 3.0; > break; > default: > return; > } >} > >..should fail to compile under djgpp v2 beta 4 with error messages... > >test.cc: In function `void term()': >test.cc:11: jump to case label >test.cc:9: crosses initialization of `double d' > >..but compile fine if I do not initialise d, and compile fine under >djgpp 1.12m4 without alteration? > I think you have to write something like this: case 1: { double d = 3.0; break; } ... The different behavior is, I think, a matter of optimization: if you don't use the d variable, the compiler can discard it and give no error ... Hope this helps and isn't wrong:) Bye, lupus -- ----------- ------- Molaro Paolo lupus AT dei DOT unipd DOT it --------- lupus AT maya DOT dei DOT unipd DOT it -------------- I am not an engineer and I proud of it.