Obj-C Exceptions In Gecko: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 19: Line 19:
When wrapping calls in a method, the first choice you'll have to make is whether to wrap specific calls or the whole method impl. Which one you pick is usually a matter of cleanliness. If there is a big method with a single Apple framework call in it, you might just want to wrap that specific call. Your choice of macros are these:
When wrapping calls in a method, the first choice you'll have to make is whether to wrap specific calls or the whole method impl. Which one you pick is usually a matter of cleanliness. If there is a big method with a single Apple framework call in it, you might just want to wrap that specific call. Your choice of macros are these:


NS_OBJC_TRY_IGNORE
* <code>NS_OBJC_TRY_IGNORE</code>
NS_OBJC_TRY_ABORT
* <code>NS_OBJC_TRY_ABORT</code>


NS_OBJC_TRY_EXPR_NULL
* <code>NS_OBJC_TRY_EXPR_NULL</code>
NS_OBJC_TRY_EXPR_ABORT
* <code>NS_OBJC_TRY_EXPR_ABORT</code>


The ones that contain EXPR are for expressions - for example:
The ones that contain EXPR are for expressions - for example:


foo = NS_OBJC_TRY_EXPR_ABORT([bar doSomething]);
<code>foo = NS_OBJC_TRY_EXPR_ABORT([bar doSomething]);</code>


They wrap an expression that returns a value. The other macros don't. They'd be for something like this:
They wrap an expression that returns a value. The other macros don't. They'd be for something like this:
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits

Navigation menu