Date: Tue, 28 Apr 1998 10:13:48 +0200 (WET) From: Andris Pavenis To: Nils Lohmann cc: djgpp AT delorie DOT com Subject: Re: exception-handling In-Reply-To: <19980427.12130299@MYHOSTNAME> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 27 Apr 1998, Nils Lohmann wrote: > Does anybody know why teh following code taken out of Stroustrup: Die > C++ > Programmiersprache > Terminates whith ABORT and doen't use the Exception Handler for range > errors. Because exception support is broken in DJGPP port of gcc-2.8.0 (unless You add extra startup module and change linker script) Will be fixed in port of gcc-2.8.1. Should be out soon. > > Compiler : DJGPP, GCC2.80, CWSDPMI V4.0 > --------------------------------------------------------- > #include > > class Range_error > { > public: > int i; > > Range_error(int ii) > { > i=ii; > } > }; > > char to_char(int i) > { > char c=i&static_cast(-1); > if (i!=c)throw Range_error(i); > return(c); > } > > > void main() > { > while (true) > { > cout< int i; > cin>>i; > try > { > char c =to_char(i); > cout< } > catch (Range_error x) > { > cerr<<"Huch:to char("< } > } > } > > > > > -- > Nils Lohmann Tel.: +49 4161 2968 > Nils Lohmann Fax: +49 4161 2968 > Bahnhofstr. 45c, 21614 Buxtehude eMail: lohmann AT tu-harburg DOT de > > > >