Hello Rene and Vladimir, Thank you for reporting this problem. I'll fix this in cint5.15.41. Masaharu Goto >Date: Sun, 19 May 2002 16:27:47 +0200 (METDST) >From: Rene Brun <Rene.Brun@cern.ch> >To: cint@pcroot.cern.ch >Subject: [CINT] [ROOT] Problem with casting in CINT (fwd) > > > >---------- Forwarded message ---------- >Date: Sun, 19 May 2002 15:54:04 +0200 >From: Vladimir Pechenov <pechenov@gsi.de> >To: roottalk <roottalk@pcroot.cern.ch> >Subject: [ROOT] Problem with casting in CINT > >Hello Rooters, > >I have found the problem with casting for classes which are inherited form >two classes. >Let's take class TH3 for example (class TH3 : public TH1, public TAtt3D) >and try to get pointer to the object of the TAtt3D class: > >void test(void) { > TH3* pH3=new TH3; > TAtt3D* pAtt3D; > printf("\n--------TH3*= %+8x\n\n",pH3); > for(Int_t i=0; i<3; i++) { > pAtt3D=dynamic_cast<TAtt3D*>(pH3); printf("1_%i_1: TAtt3D*= >%+8x\n",i,pAtt3D); > pAtt3D=dynamic_cast<TAtt3D*>(pH3); printf("1_%i_2: TAtt3D*= >%+8x\n",i,pAtt3D); > pAtt3D=dynamic_cast<TAtt3D*>(pH3); printf("1_%i_3: TAtt3D*= >%+8x\n\n",i,pAtt3D); > } > for(Int_t i=0; i<3; i++) { > pAtt3D=(TAtt3D*)pH3; printf("2_%i_1: TAtt3D*= %+8x\n",i,pAtt3D); > pAtt3D=(TAtt3D*)pH3; printf("2_%i_2: TAtt3D*= %+8x\n",i,pAtt3D); > pAtt3D=(TAtt3D*)pH3; printf("2_%i_3: TAtt3D*= %+8x\n\n",i,pAtt3D); > } >} > >The output will: > >--------TH3*= 8d61250 > >1_0_1: TAtt3D*= 8d61488 ok. >1_0_2: TAtt3D*= 8d61488 ok. >1_0_3: TAtt3D*= 8d61488 ok. > >1_1_1: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >1_1_2: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >1_1_3: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D > >1_2_1: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >1_2_2: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >1_2_3: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D > >2_0_1: TAtt3D*= 8d61488 ok. >2_0_2: TAtt3D*= 8d61488 ok. >2_0_3: TAtt3D*= 8d61488 ok. > >2_1_1: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >2_1_2: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >2_1_3: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D > >2_2_1: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >2_2_2: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D >2_2_3: TAtt3D*= 8d61250 it's pointer to TH3 but not to TAtt3D > >In compiled code it's work > >I see also some problems with reading such kind of objects from >root file by TBrowser. Some times I have wrong resalts some times > *** Break *** segmentation violation > >Best regards, > Vladimir. > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET