www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/16/14:00:04

Message-Id: <199810161852.UAA54894@ieva06.lanet.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: djgpp AT delorie DOT com
Date: Fri, 16 Oct 1998 20:57:37 +0300
MIME-Version: 1.0
Subject: Exceptions problems with DJGPP port of egcs-1.1
CC: "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com>,
Alexander Bokovoy <bokovoy AT bspu DOT unibel DOT by>
X-mailer: Pegasus Mail for Win32 (v3.01b)
Reply-To: djgpp AT delorie DOT com

--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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019