inspect for throws



 DEVELOP > c-Plus-Plus > inspect for throws

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Ian Lazarus"
Date: 08 Nov 2003 09:11:51 PM
Object: inspect for throws
Hello,
How do I analyze my code to determine which routines throw? Are there tools
which automate this? Manual inspection is prone to error.
Thanks
.

User: "Dave"

Title: Re: inspect for throws 08 Nov 2003 09:22:06 PM
"Ian Lazarus" <nobody@nowhere.net> wrote in message
news:Xfirb.220891$0v4.16684924@bgtnsc04-news.ops.worldnet.att.net...

Hello,

How do I analyze my code to determine which routines throw? Are there

tools

which automate this? Manual inspection is prone to error.

Thanks


Yep, it is prone to error and I don't know of any tools (but they may very
well be out there).
You'd have to make a complete call graph of your app., including calls to
any standard library or third-party functions. Getting the set of
exceptions that can propagate out of standard / third-party libraries and
into your code will probably be a pain in the butt!
Start at the bottom (i.e. the lowest level functions called) and propagate
up the tree the exceptions that can be thrown. At each node in your tree,
eliminate any exceptions which can propagate into a function but can't
propagate out because they are handled and not re-thrown. Any place you get
to a function that has an exception specification, don't allow anything but
the exceptions in the specification to go up past that point in your tree
(assuming your compiler supports exception specifications). And if you do
find yourself cutting out some potential exceptions in this manner, that's a
spot where your program has the potential to just die at runtime if such an
exception makes it into that function and can't continue propagating because
of the exception specification.
I hope someone else can give you more easily-implementable advice...
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER