This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problems with exceptions in egcs-1.1 (DJGPP)


Hi!

Looks that there is problems with exceptions in DJGPP port of egcs-1.1. 
The following example works Ok when compiled with DJGPP port of 
gcc-2.8.1 and also with egcs-1.1 under Linux. It fails with both egcs-1.1 
release and pgcc-1.1 release under DJGPP as last to exceptions are not 
catched. It is when throw(<type>) is not included in prototype of procedure.

-------------------------------------------------------------------------------------
#include <iostream>

class xx {};
void x1 (void) throw (xx) { xx a; throw(a); }
void x2 (void)            { xx a; throw(a); }
void x3 (void)            { int i=1; throw(i); }

int main (void)
{
   try { x1(); } catch (xx w) { cout << "catched from x1()\n"; }
   cout << "----------------\n";
   try { x1(); } catch (xx w) { cout << "catched from x1() once more\n"; }
   cout << "----------------\n";
   try { x3(); } catch (int i) { cout << "catched from x3()\n"; }
   cout << "----------------\n";
   try { x2(); } catch (xx w) { cout << "catched from x2()\n"; }
   cout << "----------------\n";
   return 0;
}
---------------------------------------------------------------------------

Andris



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]