🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Joshua Levy Fri, 30 Oct 1992 22:24
exceptions in 2.2.2?
#20
Author: 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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads