Re: [ROOT] error when executing a loop

From: Valeriy Onuchin (Valeri.Onoutchine@cern.ch)
Date: Fri Jun 11 2004 - 11:49:49 MEST


error when executing a loopHi Stelios,
try to create and execute compiled macro. That will say you if
it's  CINT bug or not.

HTH.  Regards. Valeriy
  ----- Original Message ----- 
  From: Stilianos Kesisoglou 
  To: roottalk@pcroot.cern.ch 
  Sent: Friday, June 11, 2004 11:16 AM
  Subject: [ROOT] error when executing a loop


  Hi, 

     I've encountered a problem that I find it kind of strange. I would appreciate any help. 
     The following piece of code works fine: 
  . 
  ... 
      Int_t i=0; 
      TMarker *mark; 

      mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker"); 
      ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++; 
      mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker"); 
      ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++; 
      mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker"); 
      ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++; 

      TGraph *gr = new TGraph(3,ptsX,ptsY); 
  . 
  . 

     But if I replace it with a loop, it crashes on the second iteration: 
  . 
  ... 
      Int_t i=0; 
      TMarker *mark; 

      for(Int_t iL=0;iL<3;IL++) { 
          mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker"); 
          ptsX[i] = mark->GetX(); ptsY[i] = mark->GetY(); mark->Delete(); i++; 
      } 

      TGraph *gr = new TGraph(3,ptsX,ptsY); 
  . 
  . 

     Any idea why this behaivior appears? 

     Thanks! 

  Stelios. 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET