[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: exceptions in gnu c++



Hi Paul,

On Sun, 2006-11-05 at 18:34 -0700, Paul E Condon wrote:
> On Sun, Nov 05, 2006 at 10:51:15PM +0100, Christian Holm Christensen wrote:
> > Hi Paul,
...
> > On Sun, 2006-11-05 at 14:29 -0700, Paul E Condon wrote:
...
> I have a new version of my program and I have switched to g++-3.4
> The newer version addresses issues about the actual name of the
> exception:
> #include "Sys.hh"
> #include "nmlib.hh"
> #include "rgen2.hh"
> #include "nmsim.hh"
> 
> int main( int argc, char* argv[] ){
>   clog<<"Starting nmmain..."<<endl;
>   try {
>     NMsim X;                 // instantiate the simulation object
>     X.nminit( argc, argv ); // read in parameters and generate starting conditions
>     X.nmcore( );         // do a simulation run
>   } 
>   catch (...) {
>     clog << "caught ...!!!"<< endl;
>   }
>   clog<<" After catch."<<endl;
>   return 0;
> };
> </end>
> 
> The output still shows no sign that the catch block is entered.
> Still the same 'Killed' word from somewhere.

Did you try to use GDB to figure out what's going on?  If not, give that
a whirl.   

Also, It's kinda hard to see where your code fails when we only can see
the few lines above.  Perhaps you should post your code on some web-site
so that someone else can download it, compile it, and run it, to get a
better idea of what might be wrong. 

> Should I be able to put essentially all of a program inside
> a try block like I'm doing here? 

Yep.

> It is hard to believe that this
> is an undiscovered bug in gnu c++. What might be missing from
> my code? 

Don't know - we can't see most of the code!

> I've never done try/catch before so don't hesitate
> to suggest the 'obvious'.

What you have above is fine.  However, the error is probably at some
deeper level - say somewhere in the NMsim class.

Sorry, with out more information, it will be hard to give you any hints,
directions, or help.  

Yours,

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:   cholm@nbi.dk               Web:    www.nbi.dk/~cholm
 | |



Reply to: