> Don't do that. object_getInstanceVariable() and object_setInstanceVariable()
> still assume the ivar is of an object pointer type.

As the documentation and prototypes stand, one would think that
object_getInstanceVariable() could be used like this:

    double *doublePointer = nil;
    object_getInstanceVariable(..., (void **)&doublePointer);
    NSLog(@"%f", *doublePointer); // get ivar value
    *doublePointer = 42.4242; // set ivar value (erroneously bypassing
potential GC write barriers if it were a pointer type)

... especially since outValue is documented as "On return, contains a
pointer to the value of the instance variable." In fact, I suppose it
should read "On return, contains the value of a pointer-typed instance
variable."

Furthermore, if object_getInstanceVariable() assumes an "object
pointer type" -- emphasis on _object_ -- shouldn't outValue be typed
{id *}?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to