www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/16/23:54:41

From: sl AT psycode DOT com DOT NOSPAM (Gili)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: To person who ported PGCC to DJGPP
Date: 16 Jun 1998 01:12:27 GMT
Organization: The World's Usenet -- http://www.Supernews.com
Lines: 58
Message-ID: <bWLoegW7sFse-pn2-dTLTJwX6w55L@portD36.Generation.NET>
References: <bWLoegW7sFse-pn2-NbOKdzLhgMTT AT portX56 DOT lanzen DOT net> <6m3iti$3db$1 AT rosenews DOT rose DOT hp DOT com>
Reply-To: sl AT psycode DOT com DOT NOSPAM
NNTP-Posting-Host: 205.205.119.201
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Mon, 15 Jun 1998 16:42:29, "Andrew Crabtree" 
<andrewc AT rosemail DOT rose DOT hp DOT com> wrote:

> > GCC 2.8.1 does NOT handle exceptions properly.
> This is news to me.  Whats wrong with it?

	My fault ;) I fixed it.. But it's GCC's fault as well.. Here is an 
example:

#include <conio.h>

class xError() {};

class temp1
{
  f()
  {
     temp2 test;
     test.f2();
   }
}

class temp2
{
  f2() throw(xError)
  {
     throw xError();
  }
}

main()
{
  temp1 test;
try
{
  test.f2()
}
catch (...)
{
  printf("error caught!");
}
}

	The above case is a perfect example of why my exception handling 
wasn't working.. I called f2() which in turn called f().. f() threw 
the exception (which is legal since it declared throw(xError) in its 
prototype) but when the exception reached f() it didn't find a 
throw(xError) in the prototype and stoped there with an "Abort!" 
message. This mistake occured because my C++ book didn't explain to me
that "throw(xError)" would have to be on all functions which call 
other functions which throw this exception. However, it is up to GCC 
to warn me of my syntax error. It does warn me if f() doesn't have 
throw(xError) in the prototype, so why doesn't it warn me in f2()'s 
case? That was my problem and I think the GCC authors should be 
contacted and informed of the "flaw".. However, I don't know who to 
contact..

Gili

- Raw text -


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