Thanks to all who replied. It all makes perfect sense, I just didn't know that not alloc'ing and init'ing was a fully legit move. I will add Masters of the Void to the already tall stack of reading material.



On May 19, 2008, at 6:03 PM, Jack Repenning wrote:

On May 19, 2008, at 5:18 PM, Brad Gibbs wrote:

Is it because numberToPrint is simply pointing to newNumber objects in the array that have already been allocated and initialized?

Yes, both newNumber and numberToPrint are merely pointers to some object. These objects are created in the first loop (the alloc/init sequence you noticed), and then stored into the array (the 1addObject: call). In the second loop, they already exist, but we want to grab onto one so we can print it; numberToPrint is set to point to an existing object inside the array (via -objectAtIndex:); since the object already exists, it doesn't need to be alloc'ed (allocated as sufficient blank memory to hold the object) or init'ed (fixed up to actually be such an object).



-==-
Jack Repenning
[EMAIL PROTECTED]
Project Owner
SCPlugin
http://scplugin.tigris.org
"Subversion for the rest of OS X"



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to