On Fri, Aug 1, 2008 at 3:38 PM, Arthur Coleman <[EMAIL PROTECTED]> wrote: > I hate to be dense, but what about C structs like NSRect?
There's nothing special about them - they can be allocated on the stack or on the heap, just like any other C struct. > There are initialized on the stack aren't they? Unlike instance variables, which are initialized to 0, 0.0, or nil, when an object is allocated, stack variables are *not* initialized to any particular value. That's why it's a good idea to initialize them yourself when you declare them: -(void)foo { id bar = nil; id baz; // Do stuff } In the above, bar will always be nil when you get to the "Do stuff" code. But the value of baz will be whatever happened to be at that location on the stack before you called -foo. sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net _______________________________________________ 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]