🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #20

exceptions in 2.2.2?

#20
From: Joshua Levy
Date: Fri, 30 Oct 1992 22:24
42 lines
1508 bytes
Are exceptions implemented in gcc 2.2.2?  I get syntax errors when
I try to use them, and "try" is not recongnized as a keyword.

For example, this source code: 
#include <iostream.h>


test1(int one)
{
   try {
        if (!one) throw "One was zero" ;
        if (one<0) throw "One under zero" ;
        if (one>0) throw "One over zero" ;
   }
   catch(const char*str) {
        cout << "threw <" str ">\n" ;
   } 
} 
 
 
main(int argc, char *argv[])
{ 
        int try ; 
        test1() ;
}

Results in these error messages:
ee.C: In function `int  test1 (int)':
ee.C:7: `try' undeclared (first use this function)
ee.C:7: (Each undeclared identifier is reported only once
ee.C:7: for each function it appears in.)
ee.C:7: parse error before `{'
ee.C:9: `throw' undeclared (first use this function)
ee.C:9: pf non-void function
ee.C: In function `int  main (int, char **)':
ee.C:6: too few arguments to function `int  test1 (int)'
ee.C:21: at this point in file

Note that throw and try generate undeclared variable errors when
used in exceptions, but defining try as an integer works fine.

Joshua Levy  (joshua@veritas.com)
Technical Details
Message-ID: <1992Oct30.222432.12323@Veritas.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!news.bbn.com!olivea!veritas!joshua

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!news.bbn.com!olivea!veritas!joshua
From: joshua@Veritas.COM (Joshua Levy)
Newsgroups: gnu.g++.help
Subject: exceptions in 2.2.2?
Message-ID: <1992Oct30.222432.12323@Veritas.COM>
Date: 30 Oct 92 22:24:32 GMT
Article-I.D.: Veritas.1992Oct30.222432.12323
Organization: VERITAS Software
Lines: 42