RE: [ROOT] Rootcint barfage

From: Conrad Steenberg (conrad@hep.caltech.edu)
Date: Mon Oct 21 2002 - 06:51:37 MEST


Hi Fons

Yes, you're right, of course. :-)

The effect I was trying to achieve was to have a few public const
members in the class, which means I don't need to have accessor
functions for those memebers.

Those const members caused rootcint to stumble, which is a bug, I think.

Cheers, and as always thanks for the help, it is much appreciated :-)

Conrad

On Sat, 2002-10-19 at 03:35, Fons Rademakers wrote:
> Also note that several compilers will correctly complain about "const"
> being redundant in an argument of type "Int_t". These arguments are
> passed by value and will never change:
> TFileInfo(const char *my_name, const Int_t my_mode, const Int_t my_size,
> const Int_t my_mtime)
> 
> Cheers, Fons.
> 
> 
> 
> On Fri, 2002-10-18 at 08:22, Rene Brun wrote:
> > Hi Conrad,
> > 
> > Do:
> > rootcint -f junk.cxx -c TFileInfo.h LinkDef.h
> > g++ -c junk.cxx `root-config --cflags`
> > 
> > with LinkDef.h the file below
> > //LinkDef.h
> > #ifdef __CINT__
> > 
> > #pragma link off all globals;
> > #pragma link off all classes;
> > #pragma link off all functions;
> > 
> > 
> > #pragma link C++ class TFileInfo+;
> > 
> > #endif
> > //end LinkDef.h
> > 
> > However with your class, there is still a problem with
> > the data member of type TString (would be the same with STL string).
> > Remove the "const" specifier for this member for the time being.
> > 
> > Rene Brun
> > 
> > 
> > On 17 Oct 2002, Conrad Steenberg wrote:
> > 
> > > Hi Philippe
> > > 
> > > Yes, sorry, this was with 3.03/09. 
> > > 
> > > Conrad
> > > 
> > > On Thu, 2002-10-17 at 14:13, Philippe Canal wrote:
> > > > Hi Conrad,
> > > > 
> > > > We made change on how const data member were handle in ROOT 3.03/08.
> > > > Please upgrade to a newer version and try against.
> > > > 
> > > > Cheers,
> > > > Philippe.
> > > > 
> > > > PS.  Please remember to indicate the version of ROOT that you are using.
> > > > 
> > > > -----Original Message-----
> > > > From: owner-roottalk@pcroot.cern.ch
> > > > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Conrad Steenberg
> > > > Sent: Wednesday, October 16, 2002 10:42 AM
> > > > To: ROOT mailing list
> > > > Subject: [ROOT] Rootcint barfage
> > > > 
> > > > 
> > > > Hi
> > > > 
> > > > I have a simple class that rootcint seems to have trouble with when
> > > > creating a dictionary file:
> > > > 
> > > > class TFileInfo : public TObject {
> > > > public:
> > > >   const TString name;
> > > >   const Int_t mode;
> > > >   const Int_t size;
> > > >   const Int_t mtime;
> > > > 
> > > >   TFileInfo();
> > > >   TFileInfo(const char *my_name, const Int_t my_mode, const Int_t my_size,
> > > > const Int_t my_mtime):
> > > >   name(my_name),
> > > >   mode(my_mode),
> > > >   size(my_size),
> > > >   mtime(my_mtime)
> > > >   {}
> > > >   virtual ~TFileInfo();
> > > >   ClassDef (TFileInfo, 1)
> > > > };
> > > > 
> > > > The error message is:
> > > > 
> > > > webfiledict.C: In method `void TFileInfo::Streamer (TBuffer &)':
> > > > webfiledict.C:471: passing `const TString' as `this' argument of `void
> > > > TString::Streamer (TBuffer &)' discards qualifiers
> > > > webfiledict.C:472: could not convert `TString(this->TFileInfo::mode)'
> > > > to `TString &'
> > > > /opt/root/include/TString.h:349: in passing argument 2 of `operator>>
> > > > (TBuffer &, TString &)'
> > > > webfiledict.C:473: could not convert `TString(this->TFileInfo::size)'
> > > > to `TString &'
> > > > /opt/root/include/TString.h:349: in passing argument 2 of `operator>>
> > > > (TBuffer &, TString &)'
> > > > webfiledict.C:474: could not convert `TString(this->TFileInfo::mtime)'
> > > > to `TString &'
> > > > /opt/root/include/TString.h:349: in passing argument 2 of `operator>>
> > > > (TBuffer &, TString &)'
> > > > webfiledict.C:479: passing `const TString' as `this' argument of `void
> > > > TString::Streamer (TBuffer &)' discards qualifiers
> > > > webfiledict.C: In method `void TFileInfo::ShowMembers (TMemberInspector
> > > > &, char *)':
> > > > webfiledict.C:496: passing `const TString' as `this' argument of `void
> > > > TString::ShowMembers (TMemberInspector &, char *)' discards qualifiers
> > > > 
> > > > If I remove the const qualifiers the dictionary compiles fine.
> > > > 
> > > > Regards
> > > > 
> > > > Conrad
> > > > 
> > > > --
> > > > *-----------------------------------------*
> > > > | Conrad Steenberg                        |
> > > > | Caltech, Mail Code 356-48               |
> > > > | Pasadena, CA, 91125                     |
> > > > | e-mail: conrad@hep.caltech.edu          |
> > > > | Tel: (626) 395-8758                     |
> > > > *-----------------------------------------*
> > > > 
> > > > 
> > > -- 
> > > *-----------------------------------------*
> > > | Conrad Steenberg                        |
> > > | Caltech, Mail Code 356-48               |
> > > | Pasadena, CA, 91125                     |
> > > | e-mail: conrad@hep.caltech.edu          |
> > > | Tel: (626) 395-8758                     |
> > > *-----------------------------------------*
> > > 
> -- 
> Org:    CERN, European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23, Switzerland
> E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:15 MET