Hello Jiri, Thank you for your answer. However, I am not sure about if the casting is the problem. Casting like (unsigned char)(*(unsigned char *)(long)) should work as long as 'long' can hold full information of pointer. This is clearly described in ANSI-C standard. Integral type has to hold value of pointer if size of the integral type is big enough to have the information. Beside, if this is a problem, you will see the same problem with other types, such as char, unsigned char, etc... Apart of this problem, I found a couple of bugs in my bool implementation. I'll fix those in cint5.15.38. But, this fix doesn't seem to fix this problem. Masaharu Goto >Date: 06 May 2002 15:13:16 +0200 >From: Jiri Masik <masik@pc203b.fzu.cz> >To: "Stephen J. Sanders" <ssanders@ku.edu> >Cc: roottalk@pcroot.cern.ch, cint@pcroot.cern.ch >Subject: [CINT] Re: [ROOT] root on PPC systems > >"Stephen J. Sanders" <ssanders@ku.edu> writes: > >> Hi Jiri and Damir, >> Thanks for the input. It looks like this is a problem that may solve itsel f >> with a little patience. If Debian is running gcc 3.0.4 my guess is >> the other >> distributions won't be too far behind. In the meantime, I can either >> avoid the >> use of booleans or fall back for root 3.02/07, which doesn't have this >> problem. >> >> Regards, >> Steve >> > >Hi, > >unfortunately an upgrade of gcc won't solve this completely. As Damir >mentioned there's another problem with booleans - the following >code >int main(void){ > bool a; > a=true; printf("%d\n",a); > a=false; printf("%d\n",a); > a=true; printf("%d\n",a); > > return (0); >} > >prints just 0's on my PPC. It looks like assignment to a bool >variable works only in the declaration. > >I'm trying to find out where the value of a bool is lost. >It might be related to the lines of cint/src/var.c > >#define G__GET_VAR(SIZE,CASTTYPE,CONVFUNC,TYPE,PTYPE) \ >switch(G__var_type) { \ >case 'p': /* return value */ \ > if(var->paran[ig15]<=paran) { \ > /* if(var->varlabel[ig15][paran+1]==0) { */ \ > /* value , an integer */ \ > result.ref = (G__struct_offset+var->p[ig15]+p_inc*SIZE); \ > CONVFUNC(&result,TYPE,(CASTTYPE)(*(CASTTYPE *)(result.ref)));\ > } \ > >result.ref is a long and for a boolean variable it is called as >G__GET_VAR(G__INTALLOC ,unsigned char ,G__letint ,'g' ,'G') > >so there's a cast like (unsigned char)(*(unsigned char *)(long)) > >Is this cast guaranteed to work for both little and big endian >systems? On PPC the function G__letint is called with 0 for result.ref >being either 1 or 0 as the cast is done on the insignificant byte I >guess. > >cheers > Jiri
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET