• 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: Objective-C parameter mutation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C parameter mutation


  • Subject: Re: Objective-C parameter mutation
  • From: Charles Steinman <email@hidden>
  • Date: Wed, 15 Oct 2008 17:50:15 -0700 (PDT)

--- On Wed, 10/15/08, James Trankelson <email@hidden> wrote:

> So, I've got the following method:
>
> + (void)done:(MyObj*)dObj structure:(void*)pStruct
>
> ... and when I call it with a "structure"
> parameter, say a malloc'ed
> char* at address 0x171eb070, as soon as I step into this
> method, the
> address is no longer 0x171eb070, but some garbage value
> that causes
> all sorts of trouble. Here's to hoping someone can tell
> me why this
> doesn't work...

Most likely you have a memory-stomping bug somewhere. Can you come up with a minimal case to demonstrate the problem? Your pseudocode is hiding whatever is wrong. Any type that you could use in a function call is a valid Objective-C method parameter.

Cheers,
Chuck



_______________________________________________

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

References: 
 >Objective-C parameter mutation (From: "James Trankelson" <email@hidden>)

  • Prev by Date: Re: Objective-C parameter mutation
  • Next by Date: Re: tearing my hair out: +(NSSet *)keyPathsForValuesAffectingValueForKey:
  • Previous by thread: Re: Objective-C parameter mutation
  • Next by thread: Re: Objective-C parameter mutation
  • Index(es):
    • Date
    • Thread