[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GSPredicate
From: |
Fred Kiefer |
Subject: |
Re: GSPredicate |
Date: |
Mon, 18 Jun 2018 19:15:54 +0200 |
> Am 18.06.2018 um 17:59 schrieb David Chisnall <gnustep@theravensnest.org>:
>
> On 18 Jun 2018, at 16:49, amon <amon@vnl.com> wrote:
>>
>> So you are saying this would be good to go?
>>
>> NSUInteger i;
>> NSMutableArray *a;
>> NSEnumerationOptions opts;
>> GSPredicateBlock predicate = ^() { return YES; }
>>
>> i = [a indexOfObjectWithOptions: opts passingTest: predicate];
>
> No, because that block does not take the correct number of arguments. It
> might compile, but it would be undefined behaviour. You must define a block
> that takes three arguments:
I might be wrong here, but I think that with all compilers that I know about
that code should work. The compiler will complain about the type mismatch but
if you do not access the arguments you should be able to have them on the stack
with any issue.
Of course your example is a lot more correct (and actually useful!) but the
code above should basically work, although I didn’t try it.