From: "Carolyn Kelly-Pajot" References: <6636s7$hrb AT freenet-news DOT carleton DOT ca> Subject: Re: DJGPP, GCC, and throw, try, catch Date: Wed, 3 Dec 1997 18:44:13 -0500 Lines: 49 Message-ID: <#wGOXTEA9GA.248@upnetnews03> Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Paul Derbyshire wrote in message <6636s7$hrb AT freenet-news DOT carleton DOT ca>... > > > >Does GCC/DJGPP support C++ exceptions; that is to say, the throw statement >and the try...catch block? If so, in what ways if any does it deviate from >the standard? > >(I searched the FAQ from contents to index using Internet Exploder's "Find >(on this page)..." under such items as "exception", "throw", and "C++" and >failed to find one single reference to C++ exceptions in the entire >monolithic document. (Yes, I used the real FAQ, the one that has a mass one >fourth the size of our moon, rather then the so-called "mini" FAQ >posted in the newsgroup.) There was plenty on C++, there was plenty about >exceptions (but all CPU rather than C++ exceptions), and only one of the >word "throw", in the very first question, "How to capture all the error >messages GCC throws at me". So don't tell me to read the bloody FAQ! :-)) >-- > .*. Friendship, companionship, love, and having fun are the reasons for > -() < life. All else; sex, money, fame, etc.; are just to get/express these. > `*' Send any and all mail with attachments to the hotmail address please. >Paul Derbyshire ao950 AT freenet DOT carleton DOT ca pgd73 AT hotmail DOT com You can. Just tr this code: #include int main() { cout << "I am gonna throw something like a pitcher!\n"; try { throw (char*)"Strike 1!"; } catch(char *msg) // catch error and give it a name { cout << "Error: " << msg; } cout << "Done.\n"; } C:\DJGPP>gcc throw.cc -o throw.exe -fhandle-exceptions -lstdcx -lgpp -liostr You may or may not need all these libraries - I have not really experimented yet. GCC said that throw, catch, try were C++ words, and to use them, tell it -fhandle-exceptions.