FROM : Jim Correia
DATE : Sat Nov 20 16:23:44 2004
On Nov 20, 2004, at 6:46 AM, Craig Bakalian wrote:
> How does one release, retain, copy, when using a point to a pointer in
> Foundation and Objective C?
The object ownership rules in Cocoa state that if you didn't alloc,
copy or retain the object, you aren't responsible for releasing it. If
you follow those same rules for your own code, you won't have to have
special case rules.
in isWordInQuestion:location:
*location = [[s copy] autorelease];
and now findThisWord: is no longer responsible for releasing the object
(since it didn't directly create it.)
Jim
DATE : Sat Nov 20 16:23:44 2004
On Nov 20, 2004, at 6:46 AM, Craig Bakalian wrote:
> How does one release, retain, copy, when using a point to a pointer in
> Foundation and Objective C?
The object ownership rules in Cocoa state that if you didn't alloc,
copy or retain the object, you aren't responsible for releasing it. If
you follow those same rules for your own code, you won't have to have
special case rules.
in isWordInQuestion:location:
*location = [[s copy] autorelease];
and now findThisWord: is no longer responsible for releasing the object
(since it didn't directly create it.)
Jim
| Related mails | Author | Date |
|---|---|---|
| Craig Bakalian | Nov 20, 12:46 | |
| Jim Correia | Nov 20, 16:23 |






Cocoa mail archive

