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 a whole book full of them. It's available for iBooks and Kindle, plus a direct download in PDF and ePub format. It's also available in paper for the old-fashioned. Click here for more information.

Comments:

Rudiger at 2011-05-02 00:18:16:
It's worth the wait :)

Phil Curry at 2011-05-13 07:33:53:
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

mikeash at 2011-05-19 22:43:01:
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:
Web site:
Comment:
Formatting: <i> <b> <blockquote> <code>. URLs are automatically hyperlinked.
Hosted at DigitalOcean.