mikeash.com: just this guy, you know?

Posted at 2011-04-30 02:07 | RSS feed (Full text feed) | Blog Index
Next article: Friday Q&A 2011-05-06: A Tour of MABlockClosure
Previous article: Friday Q&A 2011-04-15: Compile-Time Tips and Tricks
Friday Q&A Falls Behind
by Mike Ash  

Too much to do, not enough time, and I'm afraid Friday Q&A just didn't quite make the cut this week. I will see if I can make it up to everybody next week. Sorry to disappoint, and check back next week!

Did you enjoy this article? I'm selling whole books full of them! Volumes II and III are now out! They're available as ePub, PDF, print, and on iBooks and Kindle. Click here for more information.

Comments:

It's worth the wait :)
Embarrassed to ask this but it's something I've ignored forever. Can you discuss the ins and outs of these scenarios?
a)
@interface
{
   NSArray* array;
}
@end

b)
@interface
{
   NSArray* array;
}
@property (retain) NSArray* array;
@end

c)
@interface
{
}
@property (retain) NSArray* array;
@end

Thanks for consider this topic.
-Phil
I'm not sure if there's much room to go in depth there, but the basics are pretty simple. For (a), you have an instance variable and that's it. No property, no accessor methods.

(b) and (c) are, I believe, the same (assuming you're doing a @synthesize in the @implementation in both cases) in general as long as you're on the "modern" runtime (64-bit Mac, iOS, iOS sim). There may be certain implementation-specific gotchas, like debugger problems and compiler bugs, with (c), but I'm not sure of the specifics there.

Comments RSS feed for this page

Add your thoughts, post a comment:

Spam and off-topic posts will be deleted without notice. Culprits may be publicly humiliated at my sole discretion.

Name:
The Answer to the Ultimate Question of Life, the Universe, and Everything?
Comment:
Formatting: <i> <b> <blockquote> <code>.
NOTE: Due to an increase in spam, URLs are forbidden! Please provide search terms or fragment your URLs so they don't look like URLs.
Hosted at DigitalOcean.