RE:[mcelrath@draal.physics.wisc.edu: [ROOT]

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sat Sep 29 2001 - 01:57:21 MEST


Hello Bob,

I am glad you brought up this issue. 

Power operator is Cint's original enhancement. It is implemented
in 2 ways, '**' and '@'.  Both 2**3 and 2@3 yield 8. 

I originally made Cint in order to replace BASIC programming 
environment when I did engineering work. In that field, power
operator is a 'must' items to have.  I knew '**' causes problem
in C/C++ in strict sense, but I saw more benefit than problem.

But, I understand your point. I'll try to provide an option to
disable ** operator with a compile flag.

Thank you
Masaharu Goto



>
>Date: Thu, 27 Sep 2001 16:51:29 -0500
>From: Bob McElrath <mcelrath@draal.physics.wisc.edu>
>To: roottalk@pcroot.cern.ch
>Subject: [ROOT] Cint implements power?  (** operator)
>User-Agent: Mutt/1.2i
>
>I don't know why this is implemented in Cint, but it was left out of C++
>for good reason, and here it is:
>    root [11] TH1D* hist = (TH1D*)gROOT->FindObject("hist-costheta");
>    root [12] *hist = hist->GetBinWidth(1)**hist
>    (const double)0.00000000000000000e+00
>    root [13] 2**3
>    (const int)8
>
>The second statement (line 12) is not syntactically ambiguous in C++
>because there is no ** operator.  Apparently it is in Cint, however...
>
>Would it be possible to remove the ** operator from cint, and avoid this
>ambiguity?  A ** operator could cause some very hard-to-track-down bugs.
>
>Thanks,
>-- Bob
>
>Bob McElrath (rsmcelrath@students.wisc.edu) 
>Univ. of Wisconsin at Madison, Department of Physics
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET