• 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: NSUInteger in for-loop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUInteger in for-loop?


  • Subject: Re: NSUInteger in for-loop?
  • From: Alex Reynolds <email@hidden>
  • Date: Sun, 14 Sep 2008 21:42:23 -0700

Interesting:

...
2008-09-14 21:38:56.311 NSUIntTest[19750:10b] NSUInteger: 2
2008-09-14 21:38:56.329 NSUIntTest[19750:10b] NSUInteger: 1
2008-09-14 21:38:56.341 NSUIntTest[19750:10b] NSUInteger: 0
2008-09-14 21:38:56.344 NSUIntTest[19750:10b] NSUInteger: 4294967295
2008-09-14 21:38:56.344 NSUIntTest[19750:10b] NSUInteger: 4294967294
2008-09-14 21:38:56.346 NSUIntTest[19750:10b] NSUInteger: 4294967293
2008-09-14 21:38:56.354 NSUIntTest[19750:10b] NSUInteger: 4294967292
...

I will say that the NSLog was done for this particular example, just to see what's going on.

The loop otherwise keeps rolling along, with or without an NSLog, %d or %u.

Going without an NSLog is how I initially found out about this issue, in that my program would run into other problems related to this loop going past its bounds.

-Alex

On Sep 14, 2008, at 9:31 PM, Nathan Kinsinger wrote:

On Sep 14, 2008, at 10:15 PM, Alex Reynolds wrote:

NSLog(@"NSUInteger: %d", counter);


The correct type modifier for unsigned integers is %u not %d. Switch it and try again to see what's really happening.

--Nathan

_______________________________________________

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: NSUInteger in for-loop?
      • From: Jason Coco <email@hidden>
References: 
 >NSUInteger in for-loop? (From: Alex Reynolds <email@hidden>)
 >Re: NSUInteger in for-loop? (From: Nathan Kinsinger <email@hidden>)

  • Prev by Date: Re: NSUInteger in for-loop?
  • Next by Date: Re: NSUInteger in for-loop?
  • Previous by thread: Re: NSUInteger in for-loop?
  • Next by thread: Re: NSUInteger in for-loop?
  • Index(es):
    • Date
    • Thread