Re: Stupid block syntax!
Re: Stupid block syntax!
- Subject: Re: Stupid block syntax!
- From: Roland King <email@hidden>
- Date: Wed, 04 Jul 2012 20:45:52 +0800
On Jul 4, 2012, at 8:13 PM, Graham Cox wrote:
>
> On 04/07/2012, at 3:50 PM, Roland King wrote:
>
>> Put 'NSComparisonResult' after = and before ^ to declare the return value of the block in the code below.
>
>
> That didn't work, but after a few more wild guesses, I stumbled on the correct form:
>
> NSComparisonResult (^comp)( id<DKStorableObject>, id<DKStorableObject> ) = ^NSComparisonResult( id<DKStorableObject> a, id<DKStorableObject> b )
Sorry 'bout that Graham, I was writing it on the bus and proved that indeed the syntax is a beast and I didn't remember it either, and I went through this myself just a few days back. I sort of understand the explanation by Ken Thomas, although I never really gelled with the C function pointer syntax and always had to look that up. Not sure whether that last little wrinkle, the ^ before the return type when you declare one, is easily explained by anything.
_______________________________________________
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