C++/GCC: How to detect unhandled exceptions in compile time
问题 Introduction: In Java, if you do not catch an exception, your code doesn't even compile, and the compiler crashes on unhandled exception. Question: Is there a way to tell GCC to be "strict" as Java in this case, and to raise an error or at least a warning on unhandled exception? If not - are there IDEs (for Unix, please) that can highlight such cases as a warning? 回答1: It is not possible in C++. Exception specification is a part of a function declaration but not a part of its type . Any