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: "Carter R. Harrison" <email@hidden>
- Date: Thu, 18 Dec 2008 15:53:18 -0500
On Dec 18, 2008, at 3:44 PM, David Duncan wrote:
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
David,
Once again you have saved me from pulling my hair out. Thank you once
again for your assistance. For the rest of the folks on the thread
the solution was to remove the "&" from the front of all my pointers.
Regards,
Carter
_______________________________________________
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