Re: Accessors Question

2008-06-12 Thread mmalc crawford
On Jun 12, 2008, at 12:20 PM, Jeff LaMarche wrote: Out of curiosity, does anyone know what the synthesized accessors look like when you specify retain? Are they ' The retain/autorelease policy is dictated by the atomicity of the property. By default, object properties are returned with reta

Re: Accessors Question

2008-06-12 Thread Jeff LaMarche
Out of curiosity, does anyone know what the synthesized accessors look like when you specify retain? Are they The safe or unsafe ones? Sent from my iPhone On Jun 12, 2008, at 12:02 PM, Tito Ciuro <[EMAIL PROTECTED]> wrote: Hello, Although I prefer the safer accessors, there has been one cas

Re: Accessors Question

2008-06-12 Thread Tito Ciuro
Hello, Although I prefer the safer accessors, there has been one case where I had no choice but to return the main object pointer: - (NSString *)foo { return foo; } In my app I had a method that was populating a custom cell with a few elements. Depending on the data source, I had t

Re: Accessors Question

2008-06-12 Thread Jens Alfke
On 12 Jun '08, at 10:41 AM, Andy Lee wrote: I hadn't thought of this case. Thanks for the pointer to the docs -- I now see there is a vulnerability in the accessors I've been writing. This is kind of a religious issue. Some people like the safer accessors. Some people see them as a very e

Re: Accessors Question

2008-06-12 Thread Andy Lee
On Jun 12, 2008, at 1:31 PM, Jean-Daniel Dupas wrote: This is mainly to prevent this kind of issue: NSString *foo = [myObject foo]; [myObject setFoo:nil]; // setter release the foo ivar => foo is no longer pointing on a valid memory location. I hadn't thought of this case. Thanks for the po

Re: Accessors Question

2008-06-12 Thread Bill Bumgarner
On Jun 12, 2008, at 10:21 AM, Jeff LaMarche wrote: Lately, I've started to see accessors of the following sort: - (NSString *)foo { return [[foo retain] autorelease]; } rather than just - (NSString *)foo { return foo; } What is the purpose or benefit of doing this? It seems to

Re: Accessors Question

2008-06-12 Thread Andy Lee
On Jun 12, 2008, at 1:21 PM, Jeff LaMarche wrote: Lately, I've started to see accessors of the following sort: - (NSString *)foo { return [[foo retain] autorelease]; } I believe this is in case of something like this: NSString *myFoo = [myObject foo]; // ... stuff that causes myObj

Re: Accessors Question

2008-06-12 Thread Jean-Daniel Dupas
Le 12 juin 08 à 19:21, Jeff LaMarche a écrit : Lately, I've started to see accessors of the following sort: - (NSString *)foo { return [[foo retain] autorelease]; } rather than just - (NSString *)foo { return foo; } What is the purpose or benefit of doing this? It seems to m

Accessors Question

2008-06-12 Thread Jeff LaMarche
Lately, I've started to see accessors of the following sort: - (NSString *)foo { return [[foo retain] autorelease]; } rather than just - (NSString *)foo { return foo; } What is the purpose or benefit of doing this? It seems to me that this would add things unnecessarily to th