[ROOT] const problem

From: payman hosseini (phossein@midway.uchicago.edu)
Date: Sun Dec 21 2003 - 04:13:11 MET


hi
i have the following code:
void  start_Sjk_calculations(TTree * t1,TNtuple * onoff,const int
n_units,float * p)
{
  int i=0,j=0;
  int ntrials = (Int_t)onoff->GetEntries();
  cout<<"in new module"<<endl;
  cout<<ntrials<<endl;

}

and the output is 19, which is the correst value.
but if i try:
void  start_Sjk_calculations(TTree * t1,TNtuple * onoff,const int
n_units,float * p)
{
  int i=0,j=0;
  const int ntrials = (Int_t)onoff->GetEntries();
  cout<<"in new module"<<endl;
  cout<<ntrials<<endl;

}
the output is zero, which is wrong. why does "const" make the value of
ntrials become zero?

i am using:
Windows/NT/w2000 with VC++ 7.0,compiled with debug info, version 3.10/02
(good old tar file)**WIN32GDKDEBUG 

thanks,
paymon



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