• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Stupid objective-c question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stupid objective-c question


  • Subject: Stupid objective-c question
  • From: Gabriel Zachmann <email@hidden>
  • Date: Thu, 22 Sep 2016 01:44:15 +0200

I've got a stupid, curious question regarding a code snippet that I have found on the net (I tried it, it works).

Here is the code snippet:

- (void) observeValueForKeyPath: (NSString *) keyPath   ofObject: (id) object
                        change: (NSDictionary *) change context: (void *) context
{
   if ( context == (__bridge void *) @"mediaLibraryLoaded" )
   {
     // ...


My question is: how can the compiler know that '==' in this case is a NSString comparison?
Or is some other magic going on here? if so, which?
Does the compiler know it should perform some kind of dynamic method dispatch?


Thanks a million for all kinds of enlightenment.

Best regards,
Gabriel.






_______________________________________________

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


  • Follow-Ups:
    • Re: Stupid objective-c question
      • From: Jens Alfke <email@hidden>
    • Re: Stupid objective-c question
      • From: Graham Cox <email@hidden>
    • Re: Stupid objective-c question
      • From: Daniel Stenmark <email@hidden>
    • Re: Stupid objective-c question
      • From: Steve Mills <email@hidden>
    • Re: Stupid objective-c question
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: MLMediaLibrary sometimes does not call my KVO
  • Next by Date: Re: Stupid objective-c question
  • Previous by thread: Re: MLMediaLibrary sometimes does not call my KVO
  • Next by thread: Re: Stupid objective-c question
  • Index(es):
    • Date
    • Thread