RE:[ROOT] problem with arrays as arguments

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sat Apr 21 2001 - 14:14:24 MEST


Hello Prased,

I looked into this problem. It looks like if you change the
frind declaration as follows, it works fine.

   friend  X getRotatedX(X const & , double a_[3][3] );

Cint takes 'double [3][3]' as 'double**' and this causes the
problem.  Please add variable name for workaround for now.

Thank you
Masaharu Goto



>Date: Fri, 20 Apr 2001 02:09:37 +0400 (RET)
>From: "B.V.L.S.Prasad" <shiva@mbu.iisc.ernet.in>
>To: roottalk@pcroot.cern.ch
>Cc: rootdev@pcroot.cern.ch
>Subject: [ROOT] problem with arrays as arguments ...help ???????
>
>Dear ROOTers and C-inters,
>       I have a class called X which takes three double values, and 
>my aim is to rotate these values with a [3][3] rotation matrix..
>Can I pass arrays as arguments to the member function ??? 
>It compiles perfectly with g++. I use linux. 
>The contents are:
>****************************************************************
>#ifndef X_H
>#define X_H
>#include<iostream>
>using namespace std;
>class X
>{
>        double x_, y_, z_;
>public:
>        X(double x1,double y1, double z1);
>        X();
>        double getX() const { return x_;}
>        double getY() const { return y_;}
>        double getZ() const { return z_;}
>
>};
>
>X::X()
>{  cout<<"Please enter [x y z]: "; cin>>x_>>y_>>z_; }
>
>X::X( double x1_, double y1_, double z1_)
>        :x_(x1_),y_(y1_),z_(z1_){}
>
>void X::showXYZ(ostream& os ) constfriend  X getRotatedX(X const & , double 
[3][3] );
>{        os<< x_<<'\t'<<y_<<'\t'<<z_<<endl; }
>
>X getRotatedX(X const & aa, double a_[3][3])
>{
>   double a1_=a_[0][0]*aa.getX()+a_[0][1]*aa.getY()+ a_[0][2]*aa.getZ();
>   double b1_=a_[1][0]*aa.getX()+a_[1][1]*aa.getY()+ a_[1][2]*aa.getZ();
>   double c1_=a_[2][0]*aa.getX()+a_[2][1]*aa.getY()+ a_[2][2]*aa.getZ();
>        X p(a1_,b1_,c1_);
>        return p;
>}
>#endif
>*******************************************************
>Now I do:
>>>@user>>makecint -mk MakeBio -o bio -H x.h
>>>@user>>make -f MakeBio    //  I get the following error...
>******************************************************************
>/home/shiva/cint/cint  -w0 -zbio -nG__cpp_bio.C  -D__MAKECINT__
>-DG__MAKECINT  -c-1 -A   -DG__REGEXP -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI
>x.h 
>g++ -Wall -fguiding-decls -I/home/shiva/cint   -DG__REGEXP -DG__SHAREDLIB
>-DG__OSFDLL -DG__ANSI -O2   -c G__cpp_bio.C
>G__cpp_bio.C: In function `int G___getRotatedX_3_3(G__value *, const char
>*, G__param *, int)':
>G__cpp_bio.C:152: passing `double **' as argument 2 of `getRotatedX(const
>X &, double (*)[3])'
>G__cpp_bio.C: In function `int G___getTranslatedX_4_3(G__value *, const
>char *, G__param *, int)':
>G__cpp_bio.C:162: passing `double **' as argument 2 of
>`getTranslatedX(const X &, double (*)[1])'
>G__cpp_bio.C: In function `int G___getRotoTranslatedX_5_3(G__value *,
>const char *, G__param *, int)':
>G__cpp_bio.C:173: passing `double **' as argument 2 of
>`getRotoTranslatedX(const X &, double (*)[3], double (*)[1])'
>make: *** [G__cpp_bio.o] Error 1
>
>***********************************************************
>
>where am I doing the mistake ???
>
>thankyou very much for the help .
>
>sincerely,
>prasad.
>
>
>
>Happy Day,
>Prasad, B.V.L.S.,
>Research Scholar.
>*****************************************************************************
>   AIM OF SCIENTIFIC ADVENTURE :         NATURE CRYSTALLOGRAPHY
>*****************************************************************************
>_________   __________   ________   ___________   ___________   ___________
>|Thought|   | Fourier|   |     |   |Different|   | Fourier |   |Structure|
>| waves |-->|Analysis|-->|NATURE|-->|Forms of |-->|Synthesis|-->|   of    |
>|       |   |        |  |      |   |Knowledge|   |         |   | NATURE  |
>|_______|   |________|   |______|   |_________|   |_________|   |_________|
>
>*****************************************************************************
>shiva@mbu.iisc.ernet.in                PROTEIN CRYSTALLOGRAPHY           
...Shiva
>*****************************************************************************
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET