Skip to content

Instantly share code, notes, and snippets.

@bgerstle
Created March 24, 2015 02:41
Show Gist options
  • Select an option

  • Save bgerstle/9ca56e6bd0426450b10e to your computer and use it in GitHub Desktop.

Select an option

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 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