Christian, Thank you for pointing this out. In fact, I was aware of the problem and needed to do something about it. complex f() { complex x; return x; } root> f() **** some bad print out **** The reason is that 'f()' creates a temp object and it is unfortunately destroyed before G__ateval() call. I agree this is not only confusing but also danger for segv. I need to think about solution. Thank you Masaharu Goto ========================================================================= why does this user-defined G__ateval(T) not quite work for functions that return type T? ateval_complex.H ------------------------- int G__ateval(complex& x) { cout << "(complex&)" << x << endl; return(1); } int G__ateval(const complex& x) { cout << "(const complex&)" << x << endl; return(1); } int G__ateval(complex x) { cout << "(complex)" << x << endl; return(1); } int G__ateval(const complex x) { cout << "(const complex)" << x << endl; return(1); } ---------------------- * Version 2.22/04 3 June 1999 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* FreeType Engine v1.1 used to render TrueType fonts. CINT/ROOT C/C++ Interpreter version 5.14.4, May 22 1999 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. set automatic variable allocation mode '0' root> Processing prj-bmix.C... complex.so bmath.so root> #include <ateval_complex.H> root> complex z(1,1) root> z (const complex)(1.00000,1.00000) ** ok root> ftn_wwerf(z) (const complex)(0.00000,0.00000) ** no good root> cout << ftn_wwerf(z) << endl; (0.30474,0.20822) ** ok root>
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:34 MET