Static code analysis tool for detecting uncaught exceptions in a C++ code before compilation?
I'm looking for such a tool 开发者_如何学Cto be able to check fast if I catch all the exceptions I generate myself.
Thanks!
I think you're chasing the wind here, and the comments to Neil B's answer /should/ put you on the right track.
NEVER, EVER catch an exception just for the sake of it. Only catch exceptions where you can USEFULLY handle them. (example: retrying an operation on a backup server)
Remember almost every line of C++ can throw an AV (array index, pointer dereference, divide by zero, etc), so if you the approach of catching each of these, you'll get nowhere fast. You be heading for cargo cult coding world, where every pointer is checked for NULL before use.
Why not simply catch all possible exceptions:
int main() {
try {
// your stuff
}
catch( ... ) {
// your handler
}
}
精彩评论