Re: pointers in interactive use
Rene Brun (Rene.Brun@cern.ch)
Wed, 03 Jun 1998 12:39:48 +0200
Damir Buskulic wrote:
>
> Just a strange behaviour. If you do :
>
> root [0] TH1F* h3("h3","h3",10,0.,1.)
> root [1] h3
> (class TH1F*)0x300000000000000
>
> this is not really a good mem location (obviously segfaults if you try
> for example h3->Print() )
>
> but if you do :
>
> root [8] TH1F* h4=new TH1F("h4","h4",10,0.,1.)
> root [9] h4
> (class TH1F*)0x14017d3e8
> root [10] h4.Print()
> TH1.Print Name= h4, Total sum= 0
>
> Everything goes OK. Does that mean that we should, for the time being,
> avoid using the Cint extensions to C++ also in interactive use and not
> only in macros ?
Damir,
You have an error in your command
Instead of
TH1F* h3(...
you should have
TH1F h3(...
or alternatively
TH1F *h3 = new TH1F(..
Rene Brun