cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/21/19:14:52

From: pavenis AT lanet DOT lv
Message-ID: <B0000102674@stargate.astr.lu.lv>
To: Eduardo M Kalinowski <ekalin AT iname DOT com>, djgpp AT delorie DOT com
Date: Tue, 21 Sep 1999 21:36:40 +0300
MIME-Version: 1.0
Subject: Re: C++ Exception Support
In-reply-to: <7s7mbf$2s7$1@nnrp1.deja.com>
X-mailer: Pegasus Mail for Win32 (v3.12a)
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 21 Sep 99, at 10:23, Eduardo M Kalinowski wrote:

> In article <7s0l5p$fpc$1 AT solomon DOT cs DOT rose-hulman DOT edu>,
>   "Damian Yerrick" <reply DOT at DOT your DOT own DOT risk AT pineight DOT 8m DOT com> wrote:
> 
> > > I was trying to run a C++ program compiled that uses exceptions, but
> > I didn't post the source code.
> >
> > The custom here on comp.os.msdos.djgpp and most other
> > programming newsgroups is to post the smallest code fragment
> > that produces the error. Post your source and we'll fix it. Don't
> > post your source and we won't fix it because we're not psychic
> > and we can't see the problem.
> 
>     I didn't post the source because I was describing a problem not
> relevant to that specific code, but a general failure. Anyway, here is
> the smallest fragment that will trigger the error:
> 
> ---start---
> #include <fstream.h>
> 
> int
> main()
> {
>   try {
>     throw "Test";
>   } catch (char *e) {
>     cout << "Exception caught: " << e;
>   }
> 
>   return 0;
> }
> ---end---

You are throwing const char * but trying to catch char *
Try catching const char:
	catch (const char * e) { cout << "Catched\n"; }

At least worked for me.

Andris



- Raw text -


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