• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Stupid block syntax!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Stupid block syntax!
      • From: Ken Thomases <email@hidden>
References: 
 >Stupid block syntax! (From: Graham Cox <email@hidden>)
 >Re: Stupid block syntax! (From: Roland King <email@hidden>)
 >Re: Stupid block syntax! (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Stupid block syntax!
  • Next by Date: Dynamic modification of text search results
  • Previous by thread: Re: Stupid block syntax!
  • Next by thread: Re: Stupid block syntax!
  • Index(es):
    • Date
    • Thread