Re: [ROOT] Multiple declaration

From: Kai Koehler (kai.koehler@psi.ch)
Date: Fri Feb 23 2001 - 11:55:42 MET


Olivier Meplan wrote:
> 
> Hi Rooters!
> I have a stupid problem...but I don't know how to solve it!
> In my code I write
>     for (Int_t i=0 ; i< 10 ; i++)
>     {
>     ....
>     }
>     for  (Int_t i=0 ; i< 10 ; i++)
>     {
>     ....
>     }
> 
> Thios work well with the DEC and Linux compilers but with CC of SUN
> there is this error message:
>        Error: Multiple declaration for i.
> What can I do  (except rewrite all the code!)
> Thanks a lot
> Olivier Meplan



Hi Oliver 

Just do:

     for (Int_t i=0 ; i< 10 ; i++)
     {
     ....
     }
     for  (i=0 ; i< 10 ; i++)  <=== no new declaration
     {
     ....
     }

or:

     for (Int_t i=0 ; i< 10 ; i++)
     {
     ....
     }
     for  (Int_t j=0 ; j< 10 ; j++)  <=== declaration of
another 
     {                                                   counter
     ....
     }


The first one is probably more comfortable, but maybe the
second one is more secure(?)



Kai


-- 
 ======================================================================
                        K A I  - U .  K Ö H L E R
                      -----------------------------
 Institut für Teilchenphysik      Institute for Particle Physics
   ETH Zürich                     Swiss Federal Institute of Technology
 Paul Scherrer Institut Villigen  PSI, Villigen, Switzerland
               WLGA/E27   CH-5232 Villigen-PSI
 Tel.: +41 (0)56 310 4691         eMail: kai.koehler@psi.ch
 ----------------------------------------------------------------------
  priv.:   K. & D. Köhler         Zurzacherstr. 52 b
           CH - 5200 Brugg        Tel.: +41 (0)56 442 2973
 ======================================================================



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET