56
edits
(altering to a general discussion of exceptions) |
m (Fix wiki links to outparamdel) |
||
Line 5: | Line 5: | ||
* Replacing nsresult returns and checks with throw and catch statements | * Replacing nsresult returns and checks with throw and catch statements | ||
* Changing getter methods to return their results directly (see [outparamdel]) instead of through pointer-typed parameters | * Changing getter methods to return their results directly (see [[outparamdel]]) instead of through pointer-typed parameters | ||
The goal is to do all this without changing the behavior of Firefox, thus not introducing bugs. A somewhat more ambitious goal is to then refactor Firefox methods to be exception-safe as well, which will help avoid future bugs and may even eliminate a few existing bugs. | The goal is to do all this without changing the behavior of Firefox, thus not introducing bugs. A somewhat more ambitious goal is to then refactor Firefox methods to be exception-safe as well, which will help avoid future bugs and may even eliminate a few existing bugs. | ||
Line 11: | Line 11: | ||
== Benefits of Exceptions == | == Benefits of Exceptions == | ||
The main reason for using exceptions is improving developer productivity. Hopefully, error handling code will become cleaner and more concise, and modifying code will be easier. [outparamdel] will make it easier to call getter methods. The error-handling overhaul might even come close to entirely nuking code relating to OOMs and null outparam pointers. | The main reason for using exceptions is improving developer productivity. Hopefully, error handling code will become cleaner and more concise, and modifying code will be easier. [[outparamdel]] will make it easier to call getter methods. The error-handling overhaul might even come close to entirely nuking code relating to OOMs and null outparam pointers. | ||
We don't know what the performance effects will be, but it's expected they will be minimal either way. Exceptions can increase performance because error tests are no longer needed in the common success case, output values can be returned directly, and inline code for propagating errors is removed. But exceptions can reduce performance because throwing and catching them is relatively expensive and the catch tables take up space. | We don't know what the performance effects will be, but it's expected they will be minimal either way. Exceptions can increase performance because error tests are no longer needed in the common success case, output values can be returned directly, and inline code for propagating errors is removed. But exceptions can reduce performance because throwing and catching them is relatively expensive and the catch tables take up space. |
edits