• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question Regarding the Memory Address of Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Question Regarding the Memory Address of Objects
      • From: "Carter R. Harrison" <email@hidden>
References: 
 >Question Regarding the Memory Address of Objects (From: "Carter R. Harrison" <email@hidden>)

  • Prev by Date: Re: Enabling add button
  • Next by Date: Re: Question Regarding the Memory Address of Objects
  • Previous by thread: Re: Question Regarding the Memory Address of Objects
  • Next by thread: Re: Question Regarding the Memory Address of Objects
  • Index(es):
    • Date
    • Thread