Re: How to invoke and inline block which is passed as function argument

2010-09-17 Thread Kyle Sluder
On Fri, Sep 17, 2010 at 7:07 PM, ico wrote: > I think you misunderstood me, if a block declared with a block variable > reference to it, of > course we can call it like we would with a function pointer. What I don't > know how to invoke > the block is the case which we don't even have a function p

Re: How to invoke and inline block which is passed as function argument

2010-09-17 Thread Dave DeLong
It's only anonymous/inline to you. "sortedArrayUsingComparator:" is declared like this: - (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr This means that inside the implementation of this method, "cmptr" refers to the block, and will be invoked like this: cmptr(object1, object2); D

Re: How to invoke and inline block which is passed as function argument

2010-09-17 Thread ico
Hi Dave, I think you misunderstood me, if a block declared with a block variable reference to it, of course we can call it like we would with a function pointer. What I don't know how to invoke the block is the case which we don't even have a function pointer to it, this happens when we implement

Re: How to invoke and inline block which is passed as function argument

2010-09-17 Thread Dave DeLong
Just like you would with a function pointer: - (void) executeBlock:(void(^)(NSString * param))block { block(@"Hello world!"); } Cheers, Dave On Sep 17, 2010, at 1:32 PM, ico wrote: > Hi All, > > I just wonder how to invoke an inline block which is passed as function > argument. > We can inv

How to invoke and inline block which is passed as function argument

2010-09-17 Thread ico
Hi All, I just wonder how to invoke an inline block which is passed as function argument. We can invoke a block if we declare a block as a variable, what if you simply implement them inline where they are required as an argument. It seems you have nothing reference to that block address. For exam