• 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 of style: Returning 'pairs'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question of style: Returning 'pairs'


  • Subject: Re: A question of style: Returning 'pairs'
  • From: Keith Duncan <email@hidden>
  • Date: Wed, 02 Jul 2008 21:19:14 +0100

2) Define a custom C struct (like NSRect, but with e.g. 'string' and 'offset' members) and return objects in it. Just like any other returned objects, the caller would be expected to retain them individually if it needed to keep them around.

I'd probably do it this way if the method was private to the module; with the struct passed in by reference thereby passing any memory management issues onto the caller, i.e. it could be stack allocated or malloc'd


Otherwise if it was a public method, it follow the -get... convention returning both parameters by reference.

Keith Duncan
email@hidden, 33software.com
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >A question of style: Returning 'pairs' (From: James Montgomerie <email@hidden>)

  • Prev by Date: Re: Good mouse tracking design for dynamic view?
  • Next by Date: Re: Cocoa says not KVC compliant
  • Previous by thread: Re: A question of style: Returning 'pairs'
  • Next by thread: Re: A question of style: Returning 'pairs'
  • Index(es):
    • Date
    • Thread