Jacek, Thank you for reporting these problems. I analyzed the problem. Both are CINT syntax limitation. Please use simple expression. I'll think if those can be fixed, however, I can not put priority on fixing this kind of complex expression which you can easily find simpler and clearer ones. CINT is not aimed to be 100% C/C++ compliant interpreter. NOT RECOMMENDED SIMPLE EXPRESSION RECOMMENDED return a=b; vs a=b; return a; f()[1] = val; vs int* tmp=f(); tmp[1]=val; Best Regard, Masaharu Goto 1) returning reference of assignment expression. In following class XYZ, member function x and z returns reference. class XYZ { public: int p_x; int p_y; int p_z; int &x(int xx) {cout << "xx -> " << xx << " p_x -> " << p_x << endl; return p_x=xx;} int y(int &yy) {cout << "yy -> " << yy << " p_y -> " << p_y << endl; return p_y=yy;} int &z(int &zz) {cout << "zz -> " << zz << " p_z -> " << p_z << endl; return p_z=zz;} }; The problem is in 'return p_x=xx;'. CINT returns reference to xx. This causes the problem. Please separate assignment and return statement. p_x=x; return p_x; 2) In following source, XYZ::x , y, z returns pointer. In main function, [] operator is used for the return value of the function. f()[0] = value; Unfortunately this kind of syntax is not supported in CINT. Please rewrite this as int *tmp = f(); tmp[0] = value; -------------------------- trial2.cxx BEGIN -------------------------- #include <stream.h> class XYZ { public: int p_x[10]; int p_y[20]; int p_z[30]; int *x() {return p_x;} // int *y() {return p_y;} int *y() {cout << "*p_y -> " << *p_y ;*p_y=6;cout << " -> " << *p_y << endl;return p_y;} int *z() {return p_z;} XYZ() {return;} ~XYZ() {return;} int *x(int xx) {cout << "xx -> " << xx << " *p_x -> " << *p_x << endl;p_x[0]=xx;return p_x;} int *y(int yy) {cout << "yy -> " << yy << " *p_y -> " << *p_y << endl;p_y[0]=yy;return p_y;} int *z(int zz) {cout << "zz -> " << zz << " *p_z -> " << *p_z << endl;p_z[0]=zz;return p_z;} }; main() { XYZ *xyz = new XYZ; cout << "donald duck" << endl; xyz->x(1)[0] = 10; cout << "xyz->x(1)[0] = 10 -> " << *xyz->p_x << endl; xyz->y(2); cout << "*xyz->y(2) -> " << *xyz->p_y << endl; xyz->z(3)[0] = 30; cout << "xyz->z(3)[0] = 30 -> " << *xyz->p_z << endl; xyz->x()[0] = 4; xyz->y()[0] = 5; cout << "*xyz->y() = 5 -> " << *xyz->p_y << endl; cout << *xyz->x() << " " << *xyz->y() << " " << *xyz->z() << endl; cout << "miki mouse" << endl; }
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:31 MET