documenting exceptions

I

Ian Lazarus

Hello,
Are you aware of any tool which analyzes source code and documents the
exceptions thrown for each routine in each source file for a project?
Thanks
 
S

Steven T. Hatton

Ian said:
Hello,
Are you aware of any tool which analyzes source code and documents the
exceptions thrown for each routine in each source file for a project?
Thanks

This is one of the main reasons I don't like C++ exception syntax. I
understand there are legacy issues, but the fact that exceptions
potentially thrown by a function are not required to be part of the
signature bothers me. I believe the tool you are looking for is called a
good programmer.
 
M

Mike Smith

Ian said:
If I was a good programmer, I'd write the tool myself.

The obvious place to start is to do a text search on a .cpp file for
"throw" (ignoring comments), and then for each one found, search
backward to find the function body. That alone will tell you which
functions throw, and where the throws occur.
 
S

Steven T. Hatton

Ian said:
If I was a good programmer, I'd write the tool myself.
Sorry, I think that came across wrong. I was only suggesting that the only
way to effectively accomplish your goal is to be sure the code was written
by a programmer who understands C++ exceptions, and /does/ explicitly add
the exceptions to the declarations. I was assuming you were not only
asking about code you had written, but also about code that was written by
others. I did not intend to imply you are not qualified to do so.
 
S

Steven T. Hatton

Ian said:
Hello,
Are you aware of any tool which analyzes source code and documents the
exceptions thrown for each routine in each source file for a project?
Thanks
Have you looked at Doxygen? I really don't know what it might to for you,
but it's the best bet I know of:
http://www.stack.nl/~dimitri/doxygen/commands.html#cmdexception

And there's always:
"TODO/Wish list

"Here is a list of things that may be added in the future. As you can see,
there are way too many things on the list for me to do in any reasonable
amount of time! So if you'd like to implement one or more of these features
for me, please let me know! "

http://www.stack.nl/~dimitri/doxygen/todo.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top