Re: [ROOT] Print() collections

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Fri Mar 16 2001 - 17:05:27 MET


Hi Anton.

> Nice. Was there a reason to put consts? Does it improve anything except

It makes user code more error prone.
Rene did a very useful and very hard job. You may be can blame
him why it is not made from the beginning. But in those time it was not very common
practice. Now it is very useful, and modification of user code is not yet too big.

Victor

Anton Fokin wrote:
> 
> Nice. Was there a reason to put consts? Does it improve anything except
> making c++ funs happy? It is OK if you introduce non-compatible changes
> which can be easily seen when you recompile your code but in the case of
> const a compiler does not issue any warning on const and non-const
> "overloaded" functions. It is Ok if a user plays with one class and can
> easily see that someting is going wrong at run time. Unfortunately some
> people develop more complex things.
> 
> /Anton
> 
> http://www.smartquant.com
> 
> ----- Original Message -----
> From: Rene Brun <Rene.Brun@cern.ch>
> To: Anton Fokin <anton.fokin@smartquant.com>
> Cc: roottalk <roottalk@pcroot.cern.ch>
> Sent: Friday, March 16, 2001 2:59 PM
> Subject: Re: [ROOT] Print() collections
> 
> > Anton,
> >
> > That's why we put the changes about Constness as the first item in our
> > release notes for version 3.00/06 that you can find at:
> >
> >    http://root.cern.ch/root/roottalk/roottalk01/0956.html
> >
> > Rene Brun
> >
> > Anton Fokin wrote:
> > >
> > > Ok,
> > >
> > > now I see you've introduced
> > >
> > > TObject::Print(..) const
> > >
> > > so actually I do not overload Print with my old non-const prints...
> which I
> > > have in all my (about hundred of) classes... I also foress that some of
> > > other overloads are not overloads any longer.
> > >
> > > What a mess...
> > >
> > > /Anton
> > >
> > > http://www.smartquant.com
> > >
> > > ----- Original Message -----
> > > From: Rene Brun <Rene.Brun@cern.ch>
> > > To: Anton Fokin <anton.fokin@smartquant.com>
> > > Cc: roottalk <roottalk@pcroot.cern.ch>
> > > Sent: Friday, March 16, 2001 2:34 PM
> > > Subject: Re: [ROOT] Print() collections
> > >
> > > > Hi Anton,
> > > >
> > > > You must be using an old version. TCollection::Print uses an iterator
> > > > and not the macro ForEach.
> > > >
> > > > I take this opportunity to mention again:
> > > >  PLEASE ALWAYS INDICATE WHICH VERSION/OS YOU USE
> > > >
> > > > Rene Brun
> > > >
> > > > Anton Fokin wrote:
> > > > >
> > > > > Hi Rene&Fons,
> > > > >
> > > > > by default TCollection uses
> > > > >
> > > > > this->ForEach(TObject,Print)(option);
> > > > >
> > > > > Thus if you put objects derived from TObject with their own Print()
> > > memeber
> > > > > function you will still get
> > > > >
> > > > > OBJ: TTicker    TTicker A ticker
> > > > > OBJ: TTicker    TTicker A ticker
> > > > > OBJ: TTicker    TTicker A ticker
> > > > > OBJ: TTicker    TTicker A ticker
> > > > > OBJ: TTicker    TTicker A ticker
> > > > >
> > > > > instead of actual Prints.
> > > > >
> > > > > Ticker3  Bloomberg3  Reuter3  NYSE3  CUSIP3
> > > > > Ticker2  Bloomberg2  Reuter2  NYSE2  CUSIP2
> > > > > Ticker5  Bloomberg5  Reuter5  NYSE5  CUSIP5
> > > > > Ticker4  Bloomberg4  Reuter4  NYSE4  CUSIP4
> > > > > Ticker1  Bloomberg1  Reuter1  NYSE1  CUSIP1
> > > > >
> > > > > Is it done on purpose? If not, I propose you use another iterator
> like
> > > > > next() to get things printed correctly.
> > > > >
> > > > > Regards,
> > > > > Anton
> > > > >
> > > > > http://www.smartquant.com
> > > >
> > > >
> >
> >

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



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