Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C parameter mutation



--- 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.