[ROOT] Severe problem with struct containing Boolean variable

From: cstrato (cstrato@aon.at)
Date: Mon Feb 10 2003 - 20:57:40 MET


Dear Rooters

I am running root 3.05/02 on MacOS X 10.1.2 and get a strange
error when a struct contains a boolean variable.
The enclosed macro1.C runs without problems.
However, in macro2.C I changed fVar1 from Int_t to Bool_t, and
thus get the following error:

root [0] .x macro1.C
fTxt2 = aaa
fTxt2 = bbb
fTxt2 = ccc
root [1] .x macro2.C
Error: Illegal pointer operation (letvalue) FILE:macro2.C LINE:12
Error: Illegal pointer operation (letvalue) FILE:macro2.C LINE:13
Error: Illegal pointer operation (letvalue) FILE:macro2.C LINE:14
Error: Illegal pointer operation (letvalue) FILE:macro2.C LINE:15
*** Interpreter error recovered ***
root [2] .x macro3.C
Error: Illegal pointer operation (letvalue) FILE:macro3.C LINE:15
Error: Illegal pointer operation (letvalue) FILE:macro3.C LINE:16
Error: Illegal pointer operation (letvalue) FILE:macro3.C LINE:17
Error: Illegal pointer operation (letvalue) FILE:macro3.C LINE:18
Error: Illegal pointer operation (letvalue) FILE:macro3.C LINE:19
*** Interpreter error recovered ***
root [3]

My real problem is shown in macro3.C which results in the same
error!

Could this be a CINT problem with MacOS X?
How can this problem be solved?

Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._



//test: .x macro1.C

struct MyStruct1 {
   const char *fTxt1;
   const char *fTxt2;
   Int_t       fVar1;
   Int_t       fVar2;
   TObject    *fObj;
};

MyStruct1 kData1[] = {
   { "", "aaa", 0, 1, 0 },
   { "", "bbb", 0, 2, 0 },
   { "", "ccc", 0, 3, 0 },
   { 0,  0,     0, 0, 0 }
};

void macro1()
{
   for (Int_t i=0; kData1[i].fTxt2 != 0; i++) {
      cout << "fTxt2 = " << kData1[i].fTxt2 << endl;
   }
}


//test: .x macro2.C

struct MyStruct2 {
   const char *fTxt1;
   const char *fTxt2;
   Bool_t      fVar1;
   Int_t       fVar2;
   TObject    *fObj;
};

MyStruct2 kData2[] = {
   { "", "aaa", kFALSE, 1, 0 },
   { "", "bbb", kFALSE, 2, 0 },
   { "", "ccc", kFALSE, 3, 0 },
   { 0,  0,     0,      0, 0 }
};

void macro2()
{
   for (Int_t i=0; kData2[i].fTxt2 != 0; i++) {
      cout << "fTxt2 = " << kData2[i].fTxt2 << endl;
   }
}


//test: .x macro3.C

/* see class TGToolBar.h
*/
struct ToolBarData_t {
   const char *fPixmap;
   const char *fTipText;
   Bool_t      fStayDown;
   Int_t       fId;
   TGButton   *fButton;
};


ToolBarData_t kTBarData[] = {
   { "", "Open file",    kFALSE,  1, 0 },
   { "", "Save file as", kFALSE,  2, 0 },
   { "", "",             0,      -1, 0 },
   { "", "Print file",   kFALSE, -1, 0 },
   { 0,  0,              0,       0, 0 }
};

void macro3()
{
   for (Int_t i=0; kTBarData[i].fTipText != 0; i++) {
      cout << "fTipText = " << kTBarData[i].fTipText << endl;
   }
}



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET