Re: gPad

From: Valeriy Onuchin (onuchin@sirius.ihep.su)
Date: Wed Mar 01 2000 - 10:34:05 MET


 Hi, just a comment.

 Probably  it would be good to extent "root naming rules"
for these static functions, e.g.

 TDirectory::Dir() will be TDirectory::gDir()
 TFile::File() -> TFile::gFile()

 TMath::SomeConstant() -> TMath::kSomeConstant()


 Best regards.                Valery


> Hi,
>
> >    in the current version gPad is actually a function with the name Pad().
> > So you can use if (Pad())... However, due to possible name clashes with
> > other global functions from other libraries we've changed Pad() to R__Pad()
> > in the coming release. So, use Pad() now and change to R__Pad() when you
> > get the next release.
> >
> > Cheers, Fons.
>
> It seems that static method of class TPad will be good here, something
> like this:
>
> class TPad : public TVirtualPad
> {
>  ....
>  public:
>    static TPad * Pad(void);  // or another, better name of this method
>  ....
> };
>
> And user have to use TPad::Pad() instead of gPad.
> The benefits are
> 1) this is good C++/OO construction (global property of the class)
> 2) it does not pollute global namespace.
>
> What do you think about replacing ALL global
> ROOT variables (gDirectory, gFile, ...) by static methods of theirs
> classes:   TDirectory::Dir(), TFile::File(), ...
>
> Of course this is not necessary. But if this thing (using static methods
> of classes instead of global variables) will be intoduced, ROOT code will
> be more flexible (for such modifications like supporting threads).
>
> P.S. Please remember, moving all ROOT classes in ROOT namespace will
> eliminate problem with
> "name clashes with  other global functions from other libraries"
>
> With best wishes,
> Alexander Zvyagin.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET