Re: pointers in interactive use

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jun 03 1998 - 12:39:48 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET