RE: [ROOT] Error and Exceptions

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Sep 30 2003 - 17:35:13 MEST


Hi Thomas,

You can also implement your own error handler.  See base/src/TError.cxx for
an
example (which happens to be the default).  In your replacement you throw
any
exception you want.

We can not quite yet move to exception since at least one experiment still
uses an compiler option removing support for exception (this should change
earlier 2004)

Cheers,
Philippe.

PS. To set a break point in gdb just type

	break `Error(<tab>`

-----Original Message-----
From: Thomas Bretz [mailto:tbretz@astro.uni-wuerzburg.de]
Sent: Tuesday, September 30, 2003 10:29 AM
To: Philippe Canal
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] Error and Exceptions


Hi Philippe,

yes, you might be right, but this means, that I have to read the gdb
manual ;-))

Another advantage would be, that I can make sure, that in such a case my
program stops. Otherwise I could create results - not recognizing the
warning - which are wrong...

Thomas.

Philippe Canal wrote:
> Hi Thomas,
>
> Note that you can already 'emulated' this by just setting a break point on
> ::Error
> and TObeject::Error
>
> Cheers,
> Philippe.
>
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Thomas Bretz
> Sent: Tuesday, September 30, 2003 3:39 AM
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] Error and Exceptions
>
>
> Dear rooters,
>
> might it be possible to implement a feature such, that if I get a
> message like this
> Error in <TArrayC::operator[]>: index 577 out of bounds (size: 577,
> this: 0xbffff220)
> I can switch on raising an exception so that I can identify the position
> in the code by a debugger?
>
> I think of something like
>     if (gDebugLevel>3) // for the Error messages
>        "Raise an exception"
>
>     if (gDebugLevel>2) // for the Warning messages
>        "Raise an exception"
>
> ...
>
> I think this could simplify debugging a lot.
>
> Best regards,
> Thomas.
>
>
> #################################################################
> #################################################################
> #################################################################
> #####
> #####
> #####
> #################################################################
> #################################################################
> #################################################################
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET