Gerriet M. Denkmann ([EMAIL PROTECTED]) 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).

What is your ultimate goal?  Could you use NSData instead of NSValue?

Sean


_______________________________________________

Cocoa-dev mailing list ([email protected])

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to