• 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: A question about IMP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question about IMP


  • Subject: Re: A question about IMP
  • From: "John C. Randolph" <email@hidden>
  • Date: Fri, 14 Feb 2003 15:28:37 -0800

On Friday, February 14, 2003, at 03:15 PM, Philip Mvtteli wrote:

Am Freitag, 14.02.03, um 21:56 Uhr (Europe/Zurich) schrieb Roman Fischer:

I know I can use the IMP to call directly a methods code, eg:

SEL s = @selector(myMethod);
IMP i = [myObject methodForSelector:s];
i(anObject,anSelector);

I understand that the function call needs an object it reference to (eg. for
a link to the instance variables of an object).

But why does the function call need a selector?

Because it shows up afterwards as the '_cmd' hidden argument.


I would think that the IMP
IS the reference without the need of a Selector again. Even if I put nil
into the place of "anSelector" it seems to me to work without any problems.

If you don't use the '_cmd' argument in that method, I think, it should work.

IMP is typedef'd as a pointer to a function that takes two arguments. I would expect the compiler to complain if you omit the selector.

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

  • Follow-Ups:
    • Re: A question about IMP
      • From: Philip Mötteli <email@hidden>
References: 
 >Re: A question about IMP (From: Philip Mötteli <email@hidden>)

  • Prev by Date: Re: A question about IMP
  • Next by Date: pasting into other apps - is it possible?
  • Previous by thread: Re: A question about IMP
  • Next by thread: Re: A question about IMP
  • Index(es):
    • Date
    • Thread