delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/30/02:19:40

Sender: tim AT picard DOT skynet DOT be
Message-ID: <3B64FC58.D41549BF@falconsoft.be>
Date: Mon, 30 Jul 2001 08:19:04 +0200
From: Tim Van Holder <tim DOT vanholder AT falconsoft DOT be>
Organization: Anubex N.V.
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.16-3 i686)
X-Accept-Language: en, nl-BE, nl
MIME-Version: 1.0
To: "Rafal Maj (Raf256)" <raf256 AT go2 DOT pl>, djgpp AT delorie DOT com
Subject: Re: throw ;
References: <9jvjtq$crt$5 AT info DOT cyf-kr DOT edu DOT pl>
Reply-To: djgpp AT delorie DOT com

"Rafal Maj (Raf256)" wrote:
> 
> DJGPP allows statment   throw ;  is it ok ? If yes, then how can I catch
> such exception ?
> 
> try { throw ; } catch(...) { cerr<<"OK :)"<<endl; }
> 
> This doesn't work, throw is not catched, and it generates default_terminate
> and abort.

I wouldn't expect it to work.  A bare 'throw' rethrows the current
exception,
so it is mainly for use in a catch block.  If there is no current
exception,
i calls either unexpected() or terminate() (not sure which; check the
call
stack), which eventually calls terminate(), which for gcc calls abort().
Simply throwing _something_ should make things work.

try { throw "Rafal"; } catch (...) { cerr << "OK :)" << endl; }

-- 
Tim Van Holder - Anubex N.V.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This message was posted using plain text. I do not endorse any
products or services that may be hyperlinked to this message.

- Raw text -


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