Confirmed users
381
edits
Line 16: | Line 16: | ||
* By calling another nsresult method that can fail (i.e., is not nothrow), | * By calling another nsresult method that can fail (i.e., is not nothrow), | ||
* By using a C++ feature that can throw an exception. The primary example is allocating memory with '''new'''. | * By using a C++ feature that can throw an exception. The primary example is allocating memory with '''new'''. [https://bugzilla.mozilla.org/show_bug.cgi?id=353144 new badness] | ||
The static analysis must be designed to detect any of these conditions. Because it's hard to know what method will be called in C++, a good starting point for the analysis would be to say that a method is nothrow if it can only return 0, does not invoke new, and does not call any other method. If this doesn't pick up enough nothrow methods, we can either do it by hand or augment the analysis with a simple call graph construction. | The static analysis must be designed to detect any of these conditions. Because it's hard to know what method will be called in C++, a good starting point for the analysis would be to say that a method is nothrow if it can only return 0, does not invoke new, and does not call any other method. If this doesn't pick up enough nothrow methods, we can either do it by hand or augment the analysis with a simple call graph construction. |