On Sep 22, 2012, at 4:46 PM, Boris Dobroslav <[email protected]> wrote: > I'm perplexed by one line that appears in the file AVSPDocument.h from the > apple example code project AVSimplePlayer: > > staticvoid *AVSPPlayerItemStatusContext = &AVSPPlayerItemStatusContext; > > This definition appears outside of Objective-C @interface or @implementation, > so it must be pure C. But isn't it self-referential? Is it a C idiom? Any > pointers would be appreciated.
The intent is to get a unique pointer that differs from every other pointer value. The code can then use that address as a unique key or sentinel. The fact that this line takes the address of a global variable and stores that address in the same global variable is just a clever trick that is legal in C. -- Greg Parker [email protected] Runtime Wrangler _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
