On May 27, 2008, at 8:43 PM, Jens Alfke wrote:
This basically tells a white lie to any non-C++-savvy source file that imports the header, telling them that MyCppClass* is just some kind of pointer, and not to worry its pretty little head about exactly what it is. This is safe because (a) all pointers are the same size, so the ivar layout is correct; and (b) no one but MyCppClass.mm can actually access the raw instance variable anyway.

Lieing to the compiler is a good way to get yourself in trouble. ;)

In this case, it will change the way that GC handles the pointer, depending on how the class is compiled. GC is aware of the layout of objects and will scan only the fields that are marked __strong or are of an Objective-C object reference type.

So, depending on how exactly the class is compiled, you could end up with executable context that sees the reference as scanned and one executable context that doesn't.

Best to use a void* instead.

b.bum
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to