From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Orn E. Hansen" To: egcs@cygnus.com Subject: Classes, References and the Stack Date: Tue, 20 Jan 1998 14:54:00 -0000 Message-id: X-SW-Source: 1998-01/msg00733.html Hi, I've been using the egcs for a while, and I seem to be experiencing a small problem, which maybe related to my own ignorance... yet, it's seems a little strange. ---- class Symbol { private: public: Symbol(); ~Symbol(); Symbol& operator = (Symbol v); }; Symbol& Symbol::operator = (Symbol v) { blah } . . . Symbol get_some_symbol() { ... return symbol; } Symbol some_c_function() { Symbol b; Symbol x; x = b; x = get_some_symbol(); return x; } ----- Ok, from the above, if I do 'b = x' where x and b are variables of class Symbol, the assignment is ok. If I however, assign x from the function 'get_some_symbol' that returns a value of class symbol, it breaks inside the assignment function for class Symbol. The reason is, that the class passed to it, is non-existant and thus causes a SIGSEGV???? Of course, I may have missed something here, but this doesn't sound right. But it appears, that the value returned by the function returning value of class Symbol is put onto the stack (or it's address or whatever), but the stack values appear overwritten when it reaches the assignment function. Is this a known limitation? ---------------------------------------------------------------------------- Orn Einar Hansen oe.hansen@oehansen.pp.se oehansen@daimi.aau.dk voice+fax; +46 035 217194