Re: [ROOT] Fatal compiler error - solved, but why?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 23 2003 - 23:55:20 MEST


Hi Christian,

The compiler is right. You should use extra {..} to limit the scope
of a new variable in a swith: case block, as shown below

Rene Brun

On Wed, 
23 Jul 2003, cstrato wrote:

> Dear Rooters
> 
> Meanwhile I have found the reason for the fatal compiler error,
> but I do not understand it. It is caused by the following code:
> 
> //   TIter next(fSelections);  <====must be defined here???
>    switch (id) {
>       case B_REMOVE_TREE:
           {
>            TIter next1(fSelections);       <========should work!!
>            while ((objstr = (TObjString*)next1())) {
>               if (objstr->GetUniqueID() == selection) {
>                  fSelections->Remove(objstr);
>               }
>            }
>            break;
           }
> 
>       case B_REMOVE_ALL:
>          TIter next2(fSelections);       <=========error!!
>          while ((objstr = (TObjString*)next2())) {
>             fSelections->Remove(objstr);
>          }
>          break;
>    }
> 
> When I define TIter within the case statements, the compiler
> crashes with a fatal error. So, I have to define TIter before
> the switch statement. WHY??
> 
> Thank you.
> Best regards
> Christian
> 
> 
> cstrato wrote:
> 
> > Dear MacRooters
> >
> > I have a gui macro, which runs perfectly fine as macro, but
> > compilation with ACLiC caused an error. So I converted it to
> > a standalone application and tried to compile it, but I get
> > the same fatal error message:
> >
> > [TiBookie:~/ROOT/rootcode/xgui] cs% make -f Makefile4SelExport
> > c++ -O -pipe -Wall -I/Users/cs/ROOT/root/include   -c -o 
> > guiSelectExport.o guiSelectExport.C
> > guiSelectExport.C: In member function `void XDataFrame::SetVarlist()':
> > guiSelectExport.C:647: warning: zero-length format string
> > guiSelectExport.C: In member function `void XDataFrame::DoAddTree()':
> > guiSelectExport.C:890: warning: jump to case label
> > guiSelectExport.C:879:   crosses initialization of `TIter next2'
> >
> > Internal compiler error: Error reporting routines re-entered.
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > See <URL:http://developer.apple.com/bugreporter> for instructions.
> > {standard input}:2862:FATAL:.abort  detected.  Assembly stopping.
> > make: *** [guiSelectExport.o] Error 1
> >
> > Did anybody experience the same error message?
> > How can I check, what could be wrong with my code?
> > (root 3.05/06 on MacOS X 10.2.4)
> >
> > Thank you in advance
> >
> > Best regards
> > Christian
> > _._._._._._._._._._._._._._._._
> > C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
> > V.i.e.n.n.a       A.u.s.t.r.i.a
> > _._._._._._._._._._._._._._._._
> >
> >
> >
> >
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET