Re: Question Regarding the Memory Address of Objects
Re: Question Regarding the Memory Address of Objects
- Subject: Re: Question Regarding the Memory Address of Objects
- From: David Duncan <email@hidden>
- Date: Thu, 18 Dec 2008 12:44:19 -0800
On Dec 18, 2008, at 11:57 AM, Carter R. Harrison wrote:
[dict setValue:@"button1" forKey:[NSString stringWithFormat:@"%x",
&button1]]; // "button1" is one of my IBOutlets.
NSString *value = [dict valueForKey:[NSString
stringWithFormat:@"%x", &sender]];
It seems like the memory address of the sender is different than
what it should be. I did some debugging and the address of the
sender is always bfffe2e8 which really shouldn't be possible at all.
Your confusing the pointer with the object itself. button1 is a
pointer to a button. sender is a pointer to the object that sent the
message. When you take the address of either pointer, you get the
location of that pointer in memory - not the location of the object.
The pointer itself contains the location of the object in memory.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden