Jim,

> On Feb 19, 2016, at 16:17, Jim Adams <jim.ad...@sas.com> wrote:
> 
> I have code that looks like the following:
> 
> NSArray *sortedEvents = [events.eventSet sortedArrayUsingDescriptors:[NSArray 
> arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" 
> ascending:YES]]];
>            int64_t csi = -1LL;
> 
>            SLogInfo(@"Starting csi %ld count %d", csi, sortedEvents.count);
> 
> In the console I see:
> INFO: Starting csi -1 count -1
> The very next line crashes when the sortedEvents are accessed. What could 
> cause the array to have a -1 count?
The return type of -[NSArray count] is NSUInteger so no it is not negative one. 
 But you are logging it with %d which is for signed integers.  So, certain 
unsigned values would log as negative one,  unsigned max comes to mind as its 
twos complement should be negative one when interpreted as signed.

Sandor

> 
> 
> Note that I am seeing this in a release build so debugging is very difficult.
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari....@gmail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to