Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Detect unhandled exceptions

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
znakeeye Posted - May 09 2008 : 10:07:50 AM
A lacking feature in C++ is the ability to detect when exceptions are not handled.
foo(bool x)
{
  if (x)
     throw("Error");
}

foo(true); // The compiler will not see this problem!


Why not add a VAX-feature where you list such possible errors? You can simply walk up the call-trees and see if any thrown objects might cause an "Unhandled exception".

A "Fix errors"-button would also be convenient, where the necessary code is added:
foo(true); // I press "Fix" and it becomes...

try
{
   foo(true);
}
catch(const char *e)
{
   // TODO: Handle exception
}
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 10 2008 : 09:29:45 AM
We have no current plans to get involved in static analysis of code.
znakeeye Posted - May 09 2008 : 4:44:48 PM
It should analyze when the user tells it to do so. Just as it finds references when we tell it to :)

The more errors you can find at syntactical level, the better! Also, even if you have an #ifdef, like yours, you should indeed have a catch-block (inside an #ifdef too, of course). Hence, those defines don't affect this.

If there is a "throw" there should always be a corresponding "catch"!

(And no, I don't use such tools. No need to, since VAX makes me code like a true master :P)
feline Posted - May 09 2008 : 11:07:55 AM
An interesting idea, but I don't see how VA could hope to do this. You need to know how the code will be compiled, since you need to allow for conditional statements:

foo(bool x)
{
  if (x)
#ifdef USING_EXCEPTIONS
     throw("Error");
#else
     return -1;
#endif
}


Also when does VA analyse the code? It cannot be analysed while you are editing it, since you have not finished writing it.

Have you looked into static analysis tools?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000