Dear Rooters, (no ROOT specific question, only C++) I have the following problem (not really a problem, but I'd like to understand, what's going on). Compiling the program as follows on AIX 4.3 with xlC_r, I get a very different result than on Linux with egcs: #include <== different includes for AIX/Linux class Except { public: Except() { cout << "Except constructor\n"; } Except(const Except &e) { cout << "Except copy constructor\n"; } ~Except() { cout << "Except destructor\n"; } void fun() { cout << "Except fun\n"; } }; int main() { try { throw Except(); } catch(Except x) { cout << "Caught exception Except" << endl; x.fun(); } catch(...) { cout << "Caught undefined exception " << endl; } return 0; } On AIX, the result is On Linux I get (as I would expect it): (what I don't understand): Except constructor Except constructor Except copy constructor Except copy constructor Caught exception Except Except destructor Except fun Except copy constructor Except destructor Caught exception Except Except destructor Except fun Except destructor Except destructor Can anybody explain me, why on Linux the copy ctor is called in first place and then followed by a dtor? My suspicion is that it has something to do with the handling of local scopes in the egcs compiler on Linux. Ha somebaody any experience with that? Thank's in advance for any help about that topic, Marc Dr. Marc Hemberger |\ _,,,---,, GSI, Abteilung DV&EE ZZZzz /,`.-'`' -. ;-;;,_ Planckstr. 1 |,4- ) )-,_. ,\ ( `'-' '---''(_/--' `-'\_) 64291 Darmstadt M.Hemberger@gsi.de ** Disclaimer: My views/comments/beliefs, as strange as they are, are my own.**
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:40 MET