[ROOT] Functor objects in CINT!

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Sun Jun 24 2001 - 20:14:33 MEST


Hi Masa et al, 

There seems to be a problem with pure functor classes in CINT.  I have
the very simple script:

  class Functor 
  {
  public:
    int operator ()(int i){ cout << "hello world" << endl; return i; }
  };

  int functor () 
  {
    return Functor(10); 
  }

which you'd expect to give you 

  root [0] .x functor.C 
  hello world
  (int)10

However, instead it gives you: 

  root [0] .x functor.C  
  (int)140851656

which is probably some memory stuff of a object of class Functor.  I
believe that is not what the C++ standard says should happen. If
I do 

  root [0] .L functor.C 
  root [1] Functor f
  root [2] f(10)
  hello world
  (int)10

things are quite ok.  

I've seen the same problem with a compiled functor class.  

I believe this used to work in ROOT 3.00/06, but does not seem to work
with ROOT 3.01/05.  

Info:

  OS:       GNU/Linux (Redhat 6.2)
  ROOT:     3.01/05  (custom compiled)
  CINT:     5.15.03, June 5 2001

Yours, 

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 01 2002 - 17:50:50 MET