• 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: SELs in arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SELs in arrays


  • Subject: Re: SELs in arrays
  • From: Peter Ammon <email@hidden>
  • Date: Wed, 26 Sep 2001 16:52:41 -0400

On Tuesday, September 25, 2001, at 03:04 PM, Ondra Cada wrote:

John,

John C. Randolph (JCR) wrote at Tue, 25 Sep 2001 11:45:20 -0700:
JCR> >I guess it would be cleaner using NSValue, but I'm just used to the
JCR> >integers ;)))
JCR>
JCR> This won't work, since on Mac OS X and NEXTSTEP, selectors aren't
JCR> integers, but uniqued C strings:

This *will* work, since in any ObjC implementation selectors are convertible
to int. In NeXT (and therefore Apple) ObjC they are just pointers -- which
is a type convertible to int all right.

A pointer can be converted to an integral type that's big enough to hold it, and the conversion is implementation defined. C doesn't guarantee that any integral type is big enough to hold a pointer, so it's perfectly possible for there to be an ObjC implementation where you cannot convert a SEL to an int.

However, it's guaranteed to work with gcc/PowerPC, since the implementation defines it to be that way.

-Peter


References: 
 >Re: SELs in arrays (From: Ondra Cada <email@hidden>)

  • Prev by Date: Autobanking
  • Next by Date: Re: Fastest way to get 10.1 Developer?
  • Previous by thread: Re: SELs in arrays
  • Next by thread: Re: SELs in arrays
  • Index(es):
    • Date
    • Thread