Using "IMP" to speed up loops?
Using "IMP" to speed up loops?
- Subject: Using "IMP" to speed up loops?
- From: Ken Tozier <email@hidden>
- Date: Sat, 9 Nov 2002 23:20:24 -0500
I was reading up on how to use IMP in the NSObject documentation in
order to speed up some of my loops, but the examples don't look right.
The documentation suggested declaring IMP's like this:
typedef BOOL (*ASCIICompareIMP)(id, SEL, unsigned char);
EqualIMP test;
test = (EqualIMP)[target methodForSelector:@selector(isEqual:)];
And using them like this:
while ( !test(target, @selector(isEqual:), someObject) )
{
...
}
But given that the initialization line:
test = (EqualIMP)[target methodForSelector:@selector(isEqual:)];
already encapsulates "id" and "SEL" from the prototype, I would have
expected it to be used like:
while ( !test(someObject) )
{
...
}
What's the scoop?
Ken
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.