• 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: NSMutableArray count causes EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray count causes EXC_BAD_ACCESS


  • Subject: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • From: Christiaan Hofman <email@hidden>
  • Date: Mon, 16 Aug 2010 02:30:40 +0200


On Aug 16, 2010, at 1:57, Chris Suter wrote:

Hi Mark,

On Mon, Aug 16, 2010 at 9:00 AM, Mark Woollard <email@hidden> wrote:
[members count] returns an integer, not a class instance, so you need to use:

       NSLog(@"Count: %d",[members count]);

Actually, -[NSArray count] returns an NSUInteger, so you should really use:

    NSLog (@"Count: %lu", (long)[members count]);

I know the cast is not particularly pleasant. Apple should probably add format modifiers for NSUInteger and NSInteger.


In a sense, those ARE %lu and %ld, because it's ALWAYS true that NSUInteger=unsigned long and NSInteger=long, at least on the currently existing systems on which Mac OSX runs (both 32 and 64 bits, PPC or Intel). So the cast is really doing nothing in all possible situations (if you do it correct, so not as any of the above), it's really just a case of syntactical correctness (unless you think you need to be prepared for 128 bits or something ;).

Christiaan

Kind regards,

Chris

Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSMutableArray count causes EXC_BAD_ACCESS
      • From: Chris Suter <email@hidden>
References: 
 >NSMutableArray count causes EXC_BAD_ACCESS (From: Andrew Gehring <email@hidden>)
 >Re: NSMutableArray count causes EXC_BAD_ACCESS (From: Mark Woollard <email@hidden>)
 >Re: NSMutableArray count causes EXC_BAD_ACCESS (From: Chris Suter <email@hidden>)

  • Prev by Date: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Next by Date: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Previous by thread: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Next by thread: Re: NSMutableArray count causes EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread