www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/30/20:54:38

Xref: news2.mv.net comp.os.msdos.djgpp:8079
From: Amit Ghosh <amit DOT ghosch AT hamburg DOT netsurf DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ try-throw-catch mechanism
Date: Fri, 30 Aug 1996 15:18:20 +0200
Organization: iSC internet service center Hamburg
Lines: 39
Message-ID: <3226EA1C.6816@hamburg.netsurf.de>
References: <3222E462 DOT 167EB0E7 AT dra DOT hmg DOT gb>
Reply-To: amit DOT ghosch AT hamburg DOT netsurf DOT de
NNTP-Posting-Host: dip043-2.hamburg.netsurf.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ian Miller wrote:
> 
> Should the C++ try-throw-catch mechanism work under DJGPP?
> Has anyone got it to work?
> Yes? Any chance of a snippet of source code?
> 
> It's not documented in the gcc info, but gcc itself recognises
> the keywords and suggests compiling with the -fhandle-exceptions
> switch. I tried this, but the resulting program resolutely
> refuses to catch what I throw; it just calls terminate()
> every time.
> 
> Thanks for any assistance,
> --
> Ian Miller, Dorset, AFRICA
> DJGPP 2.00, Win95 DOS box (LFN=n), 486DX4/100, 24Mbytes RAM


Hope this code will help you:

#include <iostream.h>

int main( int, char** )
{
    try
    {
        throw 123;
    }
    catch( int k )
    {
        cout << k << " caught" << endl;
    }
    return 0;
}
 

--
Amit Ghosh
mailto:amit DOT ghosch AT hamburg DOT netsurf DOT de

- Raw text -


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