Using apple's example from the docs
float (^oneFrom)(float);
oneFrom = ^(float aFloat) {
float result = aFloat - 1.0;
return result;
};
I get two errors:
- Redefinition of 'oneFrom' with a different type: 'int' vs 'float(^)(float)'
- Type specifier missing, defaults to 'int'
Also from the doc..
If you don’t explicitly declare the return value of a block expression, it can be automatically inferred from the contents of the block. If the return type is inferred and the parameter list is void, then you can omit the (void) parameter list as well. If or when multiple return statements are present, they must exactly match (using casting if necessary).