Mail Archives: djgpp/1998/10/16/14:00:04
--Message-Boundary-26842
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
Hi!
Here is slightly better test example that ilustrates problems with exceptions
in DJGPP port of egcs-1.1 (still alpha). It works Ok with gcc-2.8.1.
If function f2() creates local object that has destructor then exceptions
work Ok also with egcs-1.1. Otherwise exception thrown from f2() is
not catched.
I don't have currently solution for this problem.
Andris
--Message-Boundary-26842
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.
---- File information -----------
File: xxx.cc
Date: 16 Oct 1998, 20:45
Size: 1725 bytes.
Type: Text
--Message-Boundary-26842
Content-type: Application/Octet-stream; name="xxx.cc"; type=Text
Content-disposition: attachment; filename="xxx.cc"
#include <iostream>
#include <string>
// Test example for exceptions problem with DJGPP port of egcs-1.1
// If the next line is uncommented all 4 exceptions are catched
#define D(x) x
// If the next line is uncommented only first 3 exceptions are catched.
// The last one ends with abort
//#define D(x)
// With gcc-2.8.1 both tests works Ok
class xx {};
class test
{
public:
string text;
test (const char * x) : text(x)
{
cout << "test::test(\"" << text << "\")\n";
}
~test ()
{
cout << "test::~test() : \"" << text << "\"\n";
}
};
void touch ( test & x ); /* Let's fool gcc that this object is really used */
void x1 (void) throw (xx)
{
D(test w1 ("void x1 (void) throw (xx)"));
D(touch (w1));
xx a;
throw(a);
}
void x2 (void)
{
D(test w2 ("void x2 (void)"));
D(touch (w2));
xx a;
throw(a);
}
void x1a (void)
{
D(test w3 ("void x1a (void)"));
D(touch (w3));
x1 ();
}
void x1b (void) throw (xx)
{
D(test w3 ("void x1b (void)"));
D(touch (w3));
x1 ();
}
int main (void)
{
try { x1(); } catch (xx w) { cout << "catched from x1()\n"; }
cout << "----------------\n";
try { x1b(); } catch (xx w) { cout << "catched from x1b()\n"; }
cout << "----------------\n";
try { x1a(); } catch (xx w) { cout << "catched from x1a()\n"; }
cout << "----------------\n";
try { x2(); } catch (xx w) { cout << "catched from x2()\n"; }
cout << "----------------\n";
return 0;
}
void touch ( test & )
{
}
--Message-Boundary-26842--
- Raw text -