objective c - Why is BOOL turned to int when negated with explicit block return type -


why BOOL , which four signed a typedef Is it changed when converted to int ?

  does not // compile NSInteger events = [[contactCountries indexesOfObjectsPassingTest: ^ (id obj, NSUInteger IDX, BOOL * off) {return [isEqualIgnoringCase obj: @ "astring"]; }] Calculation];   

Error:

to return type 'int' Back returns type 'BOOL' (aka 'signed four) should the block literally unspecified clear return type

that 'C' objective Due to ! C99 say to about operator (my emphasis): The

6.5.3.3 Single arithmetic operators, Article 5:

The result logical rejection operator! 0 if the value of its operand compares to 0 with the unequal, 1 if the value of its operand compares to 0 equals. The result type is int. Expression! E is equal to (0 == E.)

You put it:

  return (bool) [isEqualIgnoringCase obj: @ "astring"];  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -