Hi Birger, Thank you for reporting this problem. This is a Cint bug. Initialization of static member array is not supported. class A { static int a[]; }; int A::a[] = { 1,2,3 }; // Problem Please use following workaround. class A { static int *a; // declare pointer }; int a_body[] = { 1,2,3 }; // declare body of array with initialization. int* A::a = a_body; // assign pointer to array body This way everything else stays the same. The problem happens at array initialization. So following code works fine. class A { static int a[3]; // this is fine public: A() { a[0]=1; a[1]=2; a[2]=3; } // this is fine }; Thank you Masaharu Goto >Hi, > >I have problems with the following code: > >eventsample.h: >#ifndef eventsample_h >#define eventsample_h > >#if !defined(__CINT__) || defined(__MAKECINT__) >#include <TTree.h> >#endif > >class EventSample{ > Int_t varnum; > IEvent *event; > public: > static Float_t *minx,*maxx; > static Char_t *varnames[]; > > EventSample(Char_t *filename=0, Char_t *obj=0); > virtual ~EventSample(); >}; > >Float_t *EventSample::minx=0; >Float_t *EventSample::maxx=0; > >Char_t *EventSample::varnames[]={ > "xg","q2g","ptje","et","ebwj","ebnj" >}; >// eventsample_h >#endif > >This header included in the main-program compiles fine with >xlC/egcs/gcc2.7.2 but Cint crashes: > >root [1] .L eventsample.C >Error: array initialization FILE:./eventsample.h LINE:23 >Warning: Automatic variable "q2g" allocated in global scope >FILE:./eventsample.h LINE:23 >Error: Undeclared variable "q2g" FILE:./eventsample.h LINE:23 >*** Interpreter error recovered *** > >Is this my stupidness and wrong c++ code or does the interpreter have a >bug? >On the other hand it would not be necessary to tie in the names of the >variables if one would be able to extract them out of the file which is a >converted ntuple and I use an automatically generated event-class to >access it. I only need the variable-branches attached to the entries of a >float-Array and their names in the same sequence in a char** array. How >does one traverse the tree to figure out the number of branches and their >names? > >Cheers, > Birger >/------------------------------------------------------------\ >| Birger Koblitz koblitz@mail.desy.de | >| Max-Planck-Institut fuer Physik | >| (Werner Heisenberg-Institut) | >| DESY-FH1K Tel. (40) 8998-3971 | >| Notkestr. 85 | >| D-22603 HAMBURG | >\------------------------------------------------------------/
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET