RE:[ROOT] NULL pointer in method call

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu May 18 2000 - 23:21:53 MEST


Hello Holm,

Thank you for giving me a specific example of the problem. 
I can reproduce the problem on Root now.  With simpler case,
giving 0 to pointer argument works without problem. I guess
this is not simply that problem, but with some other complication.
I will continue debugging this problem.

Also, if there are other examples of the same problem, please
let me know.

Thank you
Masaharu Goto

>
>Hi ROOT'ers, 
>
>I know this question has been raised before, (see roottalk entry 
>http://root.cern.ch/root/roottalk/roottalk00/1440.html) but it didn't
>seem like there was much ado, so I thought I'd raise some. 
>
>It seems that the interactive ROOT (or CINT!?) has some problem with
>the 0 pointer as argument where it expects an object pointer. It
>complains about missing method or bad arguments, as if 0L isn't a
>valid pointer for _any_ class! As far as I can gather from the
>ANSI/ISO C++ standard section 4.10, 0L is a valid pointer for _any_
>class, and should automatically be converted to the prober class
>pointer. 
>
>I first got aware of this problem when I used g2root to get a detector
>definition. I've abstracted the basic code below:
>
>    *******************************************
>    *                                         *
>    *        W E L C O M E  to  R O O T       *
>    *                                         *
>    *   Version   2.24/04        5 May 2000   *
>    *                                         *
>    *  You are welcome to visit our Web site  *
>    *          http://root.cern.ch            *
>    *                                         *
>    *******************************************
>
>  Compiled with thread support.
>
>  CINT/ROOT C/C++ Interpreter version 5.14.37, Apr 29 2000
>  Type ? for help. Commands must be C++ statements.
>  Enclose multiple statements between { }.
>
>  root [0] TMaterial* mat = new TMaterial("mat","mat", 1, 1, 1); 
>  root [1] TBRIK* brik = new TBRIK("brik","brik", "mat", 1, 1, 1)
>  root [2] TNode* node = new TNode("node","node", brik,0,0,0,0)  
>  Error: Can't call TNode::TNode("node","node",brik,0,0,0,0) in current scope
 
FILE:/tmp/filetzcH8z_cint LINE:1
>  Possible candidates are...
>  filename       line:size busy function type and name  (in TNode)
>  (compiled)        0:0    0 public: TNode TNode(void);
>  (compiled)        0:0    0 public: TNode TNode(const char* name,const char*
 
title,const char* shapename,Double_t x=0,Double_t y=0,Double_t z=0,const char*
 
matrixname,Option_t* option);
>  (compiled)        0:0    0 public: TNode TNode(const char* name,const char*
 
title,TShape* shape,Double_t x=0,Double_t y=0,Double_t z=0,TRotMatrix* 
matrix=0,Option_t* option);
>  (compiled)        0:0    0 public: TNode TNode(TNode&);
>  filename       line:size busy function type and name  (in TNamed)
>  filename       line:size busy function type and name  (in TObject)
>  filename       line:size busy function type and name  (in TAttLine)
>  filename       line:size busy function type and name  (in TAttFill)
>  filename       line:size busy function type and name  (in TAtt3D)
>  *** Interpreter error recovered ***
>  root [3]
>
>This is on a Pentium III, running Redhat Linux 6.1. The ROOT
>distribution is the standard one from
>  ftp://root.cern.ch/root/root_v2.24.Linux.2.2.14.tar.gz 
>(no patches). 
>
>If this has been fixed in 2.24.05, sorry to bother you with this. 
>
>Cheers, 
>
>Christian  -----------------------------------------------------------
>Holm Christensen                             Phone:  (+45) 35 35 96 91 
>  Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
>  DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
>  Denmark                                    Email:       cholm@nbi.dk
>



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