I understand that something is wrong with type convertations, from my perspective this is really weard:
months is NSArray
so I have no items there:
months.count == 0
this doesn’t work like it should appears 0 < 0 -1 is true?
(0 < months.count -1) == true
but this works fine
(0 < (int)months.count -1) == false
Don’t get why?
count returns NSUInteger, which is unsigned, so
months.count -1is an unsigned expression and is evaluated to positive number, and therefore bigger than 0.when you cast it to int, the expression
(int)months.count -1is evaluated as signed, and therefore equals to -1, which is smaller than 0.