Re: confused by what seems to be a recursive declaration/definition
Re: confused by what seems to be a recursive declaration/definition
- Subject: Re: confused by what seems to be a recursive declaration/definition
- From: William Squires <email@hidden>
- Date: Thu, 11 Aug 2011 21:18:45 -0500
It's a (pointer) variable whose contents is its own memory address (the '&' operator.) Because the declaration includes 'static', the compiler simply pulls the info from the symbol tree so it already knows what a 'ANPlayerDemoPlaybackViewControllerRateObservationContext' is (it's a 'void *'), and so there is no recursion (the expression is evaluated at compile time.) Of course, this doesn't mean this construct is particularly useful (you might as well set it to NULL as anything else)!
On Aug 11, 2011, at 6:10 PM, Luther Baker wrote:
> What is this statement actually doing?
>
> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext = &
> AVPlayerDemoPlaybackViewControllerRateObservationContext;
>
> Isn't the right side evaluated first? But it doesn't yet exist? It compiles
> ... but seems to be a recursive definition??
>
> http://developer.apple.com/library/ios/#samplecode/AVPlayerDemo/Listings/Classes_AVPlayerDemoPlaybackViewController_m.html#//apple_ref/doc/uid/DTS40010101-Classes_AVPlayerDemoPlaybackViewController_m-DontLinkElementID_8
>
> Thanks,
> -Luther
> _______________________________________________
>
> 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
_______________________________________________
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