delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/19/13:12:17

Message-ID: <B0000056710@stargate.astr.lu.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: "Serge Slepov" <sergeslepov AT hotmail DOT com>, djgpp AT delorie DOT com
Date: Sat, 19 Dec 1998 19:55:46 +0200
MIME-Version: 1.0
Subject: Re: does djgpp support exceptions?
In-reply-to: <19981219081705.17476.qmail@hotmail.com>
X-mailer: Pegasus Mail for Win32 (v3.01d)
Reply-To: djgpp AT delorie DOT com

On 19 Dec 98, at 0:17, Serge Slepov wrote:

> To  : <djgpp AT delorie DOT com>
> From: Serge Slepov <sergeslepov AT hotmail DOT com>
> Subj: does djgpp support exceptions?
> 

Yes (beginning with gcc-2.8.1)

> 
> hi there,
> 
> my question is:  does djgpp support exceptions? (you know, try{} 
> catch{}... )
> I tried to run a simple example program but it seems not to catch the
> exception at all, it only says `Abort!' and stops.
> 

Seems that You have some installation problem as Your example works Ok
with both gcc-2.8.1 and newly released beta release of DJGPP port of egcs-1.1.1
(exceptions does not work very stable with latest, so You are warned)

If You are still using DJGPP-2.01  (djdev201.zip) then please upgrade 
to 2.02.
> 
> the code goes below.....
> 
> #include <stdio.h>
> 
> int main( int argc, char *argv[] )
> {
>     try
>     {
>         if( argc == 1 )
>             throw "Insufficient no. of arguments. ";
> 
>         printf("No exception generated.\n");
>         return 0;
>     }
>     catch( const char * msg )
>     {
>         printf("%s\n", msg );
>         fflush(stdout);
>     }
> 
>     printf("continue here after exception.\n" );
>     return 1;
> }
> 

- Raw text -


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