Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You also need to take care with objects passed by reference. The following code will work:
- NSError *error;
- BOOL OK = [myObject performOperationWithError:&error];
- if (!OK) {
- // Report the error.
- // ...
- However, the error declaration is implicitly:
- NSError * __strong e;
- and the method declaration would typically be:
- -(BOOL)performOperationWithError:(NSError * __autoreleasing *)error;
- The compiler therefore rewrites the code:
- NSError * __strong error;
- NSError * __autoreleasing tmp = error;
- BOOL OK = [myObject performOperationWithError:&tmp];
- error = tmp;
- if (!OK) {
- // Report the error.
- // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement