Created
March 24, 2015 02:41
-
-
Save bgerstle/9ca56e6bd0426450b10e to your computer and use it in GitHub Desktop.
Objective-C @try/@catch/@finally prevents "control reaches end of non-void function" warnings/errors from being detected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This demonstrates a critical, yet absent compiler warning for the missing return in this non-void function. | |
| - (id)nonVoidFunctionWithoutReturn { | |
| @try { | |
| [NSException raise:@"foo" format:nil]; | |
| } @catch (NSException* e) { | |
| NSLog([e description]); | |
| } | |
| /* | |
| @finally { | |
| // adding @finally doesn't make a difference | |
| } | |
| */ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment