Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Detect unhandled exceptions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

znakeeye
Tomato Guru

379 Posts

Posted - May 09 2008 :  10:07:50 AM  Show Profile  Reply with Quote
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
}

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 09 2008 :  11:07:55 AM  Show Profile  Reply with Quote
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?

zen is the art of being at one with the two'ness
Go to Top of Page

znakeeye
Tomato Guru

379 Posts

Posted - May 09 2008 :  4:44:48 PM  Show Profile  Reply with Quote
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)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 10 2008 :  09:29:45 AM  Show Profile  Reply with Quote
We have no current plans to get involved in static analysis of code.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000