Skip to content

Instantly share code, notes, and snippets.

@thornpig
Last active January 20, 2016 23:27
Show Gist options
  • Save thornpig/e7f6d3b2d40fd2b11038 to your computer and use it in GitHub Desktop.
Save thornpig/e7f6d3b2d40fd2b11038 to your computer and use it in GitHub Desktop.
NSUInteger vs NSInteger
NSUInteger a = 0;
NSInteger b = 3;
NSInteger c = 1;
BOOL d = c >= a - b; //d is NO because a - b is implicitly converted to NSUInteger 4294967294
NSString *string = @"";
BOOL e = c >= string.length - b; // e is NO because string.lenth returns NSUInteger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment