Re: [ROOT] Cint warnings on const members

From: Valeri Fine (Faine) (
Date: Fri Feb 02 2001 - 18:36:16 MET

> Hello everybody,
> I have a class with some const members.
> Somebody knows how to deliver from the warnings?

  Since you define your data-memebrs as "const" it can not be changed by any 
  class method but constructor of that class.

 This means this data-member can not be assigned by "Streamer" merthod either.
 The last means the "const data-member" can not be "persistent" since by your design
  it can not be gottten from any external source but the class constructor parameters.

What you need to avoid the warning you have to define the "const" data-member 
 as "non-persistent"  by introducing the the comment with the "expmanation mark" within 
class header file.

  const CBananaPlant *mmm; //!

  Hope this helps.

> BananaPlantCint.cxx: In method `void CBananaEvent::Streamer(class
> TBuffer &)':
> BananaPlantCint.cxx:258: warning: converting to `CBananaPlant *' from
> `const CBananaPlant *' discards const
> BananaPlantCint.cxx:258: warning: initializing non-const `CBananaPlant
> *&' with `const CBananaPlant *' will use a temporary
> BananaPlantCint.cxx:40: warning: in passing argument 2 of `operator
> >>(TBuffer &, CBananaPlant *&)'
> Regards,
> Viktor

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