FROM : Keith Duncan
DATE : Wed Jul 02 22:19:14 2008
> 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_removed>, 33software.com
DATE : Wed Jul 02 22:19:14 2008
> 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_removed>, 33software.com
| Related mails | Author | Date |
|---|---|---|
| James Montgomerie | Jul 2, 20:48 | |
| Abernathy, Joshua | Jul 2, 20:56 | |
| Stephen J. Butler | Jul 2, 20:58 | |
| Jean-Daniel Dupas | Jul 2, 21:14 | |
| Andy Lee | Jul 2, 21:22 | |
| Andy Lee | Jul 2, 21:30 | |
| Joel Norvell | Jul 2, 21:33 | |
| Bob Smith | Jul 2, 22:03 | |
| Keith Duncan | Jul 2, 22:19 | |
| David Casseres | Jul 4, 04:02 |






Cocoa mail archive

