• 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
Re: Couple of questions about the "SEL" datatype
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Couple of questions about the "SEL" datatype


  • Subject: Re: Couple of questions about the "SEL" datatype
  • From: Jonathon Mah <email@hidden>
  • Date: Mon, 24 Jan 2005 14:24:51 +1030

On 24 Jan 2005, at 07:21, Ken Tozier wrote:

Is the SEL datatype fixed in size?

A "SEL" is simply a C string (char *) that is unique in the runtime. Thus:


NSString *method1 = @"copyWithZone:";
NSMutableString *method2 = [[NSMutableString alloc] initWithString:@"copyWIthZone:"];
// Now (method1 != method2), because they are different points in memory.
SEL sel1 = NSSelectorFromString(method1);
SEL sel2 = NSSelectorFromString(method2);
// Now (sel1 == sel2), i.e. they both point to the exact same string in memory
NSLog(@"Selector is this: %s", (char *)sel1);


You won't be able to store a SEL (i.e. the address it points to) on disk and have it work again later (after relaunching your app), but you can (as mentioned) store the NSString (or even the C string) and get the correct pointer through NSSelectorFromString.


Jonathon Mah email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Couple of questions about the "SEL" datatype
      • From: Roarke Lynch <email@hidden>
References: 
 >Couple of questions about the "SEL" datatype (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: NSDocument subclass (newbie) question Š
  • Next by Date: Re: Manual binding questions.
  • Previous by thread: Re: Couple of questions about the "SEL" datatype
  • Next by thread: Re: Couple of questions about the "SEL" datatype
  • Index(es):
    • Date
    • Thread