@try @catch
@try @catch
- Subject: @try @catch
- From: Georg Seifert <email@hidden>
- Date: Thu, 14 Aug 2008 12:58:21 +0200
hello,
is it recommended to use @try .. @catch blocks as flow control like it
is used in Python. They say explicitly to use it rather than do a lot
of test before just try if it works to look after it only if it fails.
I could imagine something:
- (id) layerInstance {
if ([[layerInstancesController selectedObjects] count] > 0) {
return [[layerInstancesController selectedObjects] objectAtIndex:0];
}
return nil;
}
to look like:
- (id) layerInstance {
@try {
return [[layerInstancesController selectedObjects] objectAtIndex:0];
}
@catch {
return nil;
}
}
it should run faster if I do not have the if clause? Or are there any
drawbacks?
Regards
Georg
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden