• 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: NSPointerArray + fast enumeration for non-object types?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPointerArray + fast enumeration for non-object types?


  • Subject: Re: NSPointerArray + fast enumeration for non-object types?
  • From: "Ken Ferry" <email@hidden>
  • Date: Thu, 20 Nov 2008 18:09:55 -0800

Hi Jim,

On Thu, Nov 20, 2008 at 4:02 PM, Jim Correia <email@hidden> wrote:
> The header documentation for NSPointerArray says:
>
>> Fast enumeration, copying, and archiving protocols are applicable only
>> when NSPointerArray is configured for Object uses. Since the array may
>> contain NULLs, fast enumeration (for..in) will yield NULLs.  As a
>> convenience, fast enumeration will also enumerate other types of pointers.
>> Copying and coding are undefined for non-object uses.
>
> That seems self contradictory with respect to fast enumeration. It is only
> applicable when NSPointerArray is configured for Objects, but as a
> convenience, it will enumerate non-object types anyway even though it is
> inappropriate to do so?
>
> Can anyone offer clarification?

Oops!  Please file a bug about this.  Yes, it's self-contradictory.
No, you shouldn't try to use fast enumeration with non-objects.  Even
if it fails to crash now, that might not hold in the future.

Thanks,
Ken
Cocoa Frameworks

> When I try to be honest about the enumeration, i.e.
>
>        for (void *pointer in pointerArray) {
>
>        }
>
> the compiler complains with
>
>        pointer-array.m:20: error: selector element does not have a valid
> object type
_______________________________________________

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

References: 
 >NSPointerArray + fast enumeration for non-object types? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: How do you get the OS X version number in C or C++?
  • Next by Date: Re: GC and print operations cause objects not to finalize?
  • Previous by thread: NSPointerArray + fast enumeration for non-object types?
  • Next by thread: question about colorSpace conversions
  • Index(es):
    • Date
    • Thread