• 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
Strange NSInvocation behavior when passing pointers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange NSInvocation behavior when passing pointers


  • Subject: Strange NSInvocation behavior when passing pointers
  • From: Philippe Mougin <email@hidden>
  • Date: Sun, 14 Jul 2002 13:23:48 +0200

When a method returning a pointer (other than an object pointer) is invoked through a NSInvocation, it seems that you don't get back the original pointer returned by the method.

Instead, it seems that NSInvocation dereference the pointer, copy the value it points to, and give you back a pointer to this copy (note: if the invoked method is declared to return a generic pointer (i.e. void *), NSInvocation does not have enough information to dereference the pointer, so in this case it give you back the original pointer)

I haven't verified, but I suppose the same kind of "copying" behavior is not only applied to return value but also to arguments, in the case of pointers.

All of this seems similar to the distributed object system behavior regarding pointers.

Questions:

1) What is the point of doing this in the non-distributed situation? (Doesn't sounds like a good idea to me).

2) Do you know if this NSInvocation behavior this documented somewhere?

3) In my program, I want to get at the "real" pointers returned or passed as argument. Is there a way to turn-off this strange NSInvocation behavior?

Best,

Phil
_______________________________________________
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: Strange NSInvocation behavior when passing pointers
      • From: Nathan Day <email@hidden>
  • Prev by Date: Re: Carbon API with carbon
  • Next by Date: Re: Carbon API with carbon
  • Previous by thread: Creating objects in C-JAVA
  • Next by thread: Re: Strange NSInvocation behavior when passing pointers
  • Index(es):
    • Date
    • Thread