Re: How to debug a corrupted stack
Re: How to debug a corrupted stack
- Subject: Re: How to debug a corrupted stack
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Fri, 8 Aug 2008 11:32:18 +0700
On 8 Aug 2008, at 09:04, Sean McBride wrote:
Gerriet M. Denkmann (email@hidden) on 2008-8-8 9:49 PM said:
some_type a;
NSValue *data = [ NSValue value: &a withObjCType: @encode
(some_type) ];
followed by:
some_type b;
[ data getValue: &b ];
is unsafe, dangerous and strictly to be avoided - especially if the
definiton of "some_type" is buried in some frameworks.
Instead one must use:
some_type *bPointer = [ data bytes ];
The only problem: NSValue has no method "bytes".
Note that the docs say that value:withObjCType: and objCType "may be
deprecated in a future release". Also, I suspect objCType would be
problematic in GC apps (see archive discussion of NSData's btyes
method).
On the other hand NSData will definitely have problems if it is sent
via Distributed Object to another application with another endian-ness.
But this not something which I will do with this app. And I am also
not sure whether NSValue will do the right thing with DO.
What is your ultimate goal? Could you use NSData instead of NSValue?
Just to transport data. In the case which caused me so much trouble
144 bytes of FSCatalogInfo.
But, now that you mention it, I could use NSData instead.
And probably will, as I am tired of fighting with NSValue.
Thanks for this suggestion. I was kind of hooked on NSValue for - as
I see now - no good reason.
Kind regards,
Gerriet.
_______________________________________________
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