• 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: Block error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Block error


  • Subject: Re: Block error
  • From: Rick Mann <email@hidden>
  • Date: Fri, 15 Jul 2011 18:55:45 -0700

On Jul 15, 2011, at 18:35 , Gwynne Raskind wrote:

> To my knowledge, the "correct" way to declare a block's return type is like so:
>
> ^ returntype (params) { code }
>
> So the above example would become:
>
> ^ id (id inParam1) {
> Foo *foo = nil;
> if ([inParam1 isEqual:@"baz"])
>  foo = [[Foo alloc] init];
> return foo;
> };
>
> And you can typedef and cast a block using the standard
> pointer-to-function cast syntax:
>
> id    (^foob)(id) = ^ id (id inParam1) { ... };
>
> typedef id   (^FooBlock)(id);
> FooBlock foob = ^ id (id inParam1) { ... };

That does seem to work as one would expect. Thanks!

--
Rick


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Block error (From: Rick Mann <email@hidden>)
 >Re: Block error (From: Jens Alfke <email@hidden>)
 >Re: Block error (From: Rick Mann <email@hidden>)
 >Re: Block error (From: Eeyore <email@hidden>)
 >Re: Block error (From: Rick Mann <email@hidden>)
 >Re: Block error (From: Gwynne Raskind <email@hidden>)

  • Prev by Date: Re: Block error
  • Next by Date: Re: Block error
  • Previous by thread: Re: Block error
  • Next by thread: Re: Block error
  • Index(es):
    • Date
    • Thread