Re: Accessor methods and (auto)release <Memory trail>
Re: Accessor methods and (auto)release <Memory trail>
- Subject: Re: Accessor methods and (auto)release <Memory trail>
- From: Brant Vasilieff <email@hidden>
- Date: Wed, 31 Jul 2002 14:34:12 -0700
On Wednesday, July 31, 2002, at 10:34 AM, cocoa-dev-
email@hidden wrote:
I am concerned about the more subtle case such as:
str = [myWindow title];
...
[myDocument saveDocument];
...
... use str ...
Assuming myDocument is the document in myWindow, a side effect of the
"saveDocument" call might be to release the title you got back in the
first line. A retain/autoreleased return from the first line would
eliminate this potential issue, which could be hard to debug.
Thanks for the clearer example.
I was curious about the difference between returning [[title retain]
autorelease] and [[title copy] autorelease].
Does the compiler provide special treatment for retain as a keyword,
treating it as an inline macro?
Also, are the retain, release and autorelease messages atomic?
Cheers,
Brant
_______________________________________________
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.