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: References: <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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Mon, 15 Jun 1998 16:42:29, "Andrew Crabtree" 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 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