Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Greg Parker
On Aug 11, 2011, at 9:11 PM, Jens Alfke wrote: > On Aug 11, 2011, at 8:59 PM, Jim Correia wrote: >> For KVO contexts, you don't care about the value, but you do care that it is >> unique. > > I generally use a selector for this purpose. It doesn’t require a separate > definition, and it’s also e

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Luther Baker
On Thu, Aug 11, 2011 at 9:26 PM, William Squires wrote: > ... > I believe you have two erroneous '*'s in there! '*context:' doesn't make > sense as part of a method signature in ObjC, and there shouldn't be an > asterisk after 'context' but before the opening '{' (an '*' comes before an > identif

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Kyle Sluder
On Thu, Aug 11, 2011 at 9:11 PM, Jens Alfke wrote: > > On Aug 11, 2011, at 8:59 PM, Jim Correia wrote: > >> For KVO contexts, you don't care about the value, but you do care that it is >> unique. > > I generally use a selector for this purpose. It doesn’t require a separate > definition, and it’

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Jens Alfke
On Aug 11, 2011, at 8:59 PM, Jim Correia wrote: > For KVO contexts, you don't care about the value, but you do care that it is > unique. I generally use a selector for this purpose. It doesn’t require a separate definition, and it’s also easy to use it to tell the observer to delegate to the

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Jim Correia
On Aug 11, 2011, at 7:27 PM, William Squires wrote: > On Aug 11, 2011, at 6:51 PM, Kyle Sluder wrote: > >> On Thu, Aug 11, 2011 at 4:26 PM, Jens Alfke wrote: >>> >>> On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: >>> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Ken Thomases
On Aug 11, 2011, at 9:27 PM, William Squires wrote: > On Aug 11, 2011, at 6:51 PM, Kyle Sluder wrote: > >> On Thu, Aug 11, 2011 at 4:26 PM, Jens Alfke wrote: >>> >>> On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: >>> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread William Squires
Oops, my typo: of course I meant to type 'AVPlayerDemoPlaybackViewControllerRateObservationContext'... a 'N' got in there somehow! :) On Aug 11, 2011, at 9:18 PM, William Squires wrote: > It's a (pointer) variable whose contents is its own memory address (the '&' > operator.) Because the decl

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread William Squires
On Aug 11, 2011, at 6:51 PM, Kyle Sluder wrote: > On Thu, Aug 11, 2011 at 4:26 PM, Jens Alfke wrote: >> >> On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: >> >>> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext = & >>> AVPlayerDemoPlaybackViewControllerRateObservationCont

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread William Squires
On Aug 11, 2011, at 6:36 PM, Luther Baker wrote: > I see. > > In this case, it is passed in as the context of a KVO registration ... and > as such, it facilitates a direct equality test in the KVO handler. > > - (void)observeValueForKeyPath:(NSString*)path ofObject:(id)object change:( > NSDicti

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread William Squires
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 *'),

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Kyle Sluder
On Thu, Aug 11, 2011 at 4:26 PM, Jens Alfke wrote: > > On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: > >> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext = & >> AVPlayerDemoPlaybackViewControllerRateObservationContext; > > It’s initializing the variable to point to itself.

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Luther Baker
I see. In this case, it is passed in as the context of a KVO registration ... and as such, it facilitates a direct equality test in the KVO handler. - (void)observeValueForKeyPath:(NSString*)path ofObject:(id)object change:( NSDictionary*)change *context:(void*)context* { if (context == AVPla

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Jens Alfke
On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: > static void *AVPlayerDemoPlaybackViewControllerRateObservationContext = & > AVPlayerDemoPlaybackViewControllerRateObservationContext; It’s initializing the variable to point to itself. Which seems sort of pointless, but I don’t know the context

confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Luther Baker
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