• 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
Function calling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Function calling


  • Subject: Function calling
  • From: "Theodore H. Smith" <email@hidden>
  • Date: Wed, 25 May 2005 22:58:10 +0100

I've noticed that functions that return (id), can have methods called from them.

[item childAtIndex:index];

Here, item is actually an "id". And so we can't know what type of object it is, or whether a childAtIndex method actually exists.

So, my question is, how does this work?

At runtime, an untyped object is about to be called, with a method named "childAtIndex". OK, what information does the binary use to figure out what is the actual function address to jump to? A list of all "childAtIndex" methods in the compiled app?

I'm assuming Cocoa does not use some kind of string based hash table, because that would be ridiculously slow.

Would strong typing speed things up? For example, is:

MyClassType* item = SomeSomeObj();
return [item childAtIndex:index];

faster than this?

id item;
return [item childAtIndex:index];

--
elfdata.com/plugin/ Industrial strength string processing, made easy.

"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."

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


  • Follow-Ups:
    • Re: Function calling
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Grouping undo-able actions with CoreData
  • Next by Date: Custom disclosure triangles on NSOutlineView
  • Previous by thread: examples of sync services for pushing tasks to iCal
  • Next by thread: Re: Function calling
  • Index(es):
    • Date
    • Thread