RE:Re: bug in TMinuit calling "fcn" func

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Wed Jan 13 1999 - 15:07:24 MET


Rene and Stefan,

>I have reported to Masa the problem with the array declaration.

Thank you for reporting the bug. 
I looked into the code and found 3 problems. 

1) Cint can not handle following code

    void f() {
      const int SIZE=50;
      static double d[SIZE];
    }

   The reason why is that static array d needs to be initialized when source
   code is read, but SIZE is only activated when f() is called. Please 
   declare static array size index constant as global variable. 

   const int SIZE=50;
   void f() {
     static double d[SIZE];
   }

2) Array initialization voids bytecode compilation

    void f() {
      static double d[] = { 1,2,3,4,5 }; // Bytecode voided, very very slow
    }

   Please use such initialization for global variable declaration.

   static double d[] = { 1,2,3,4,5 };
   void f() {
      .
   }

  It is difficult to improve above limitation. Please try above workaround.
  Warning message can be displayed if you want.

3) Explicit conversion to typedefed fundamental type causes problem in some ca
se
   void f(int i) {
     Double_t a=3.14,b;
     b = Double_t(i) / a; // BUG
   }

   While equivalent expression works.

     b = double(i) / a;   // OK
     b = (Double_t)i / a; // OK
     b = i/a;             // OK

   I'm investigating this.


Due to limitation and potential bug of cint, I would suggest following coding
manner.

  1) Avoid static variable in function. static variable in file scope can be
     safer.
  2) Use '(Type)val' casting style if you have problem with 'Type(val)'
     expression. 

Masaharu Goto



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