Reputation: 3
Why does the compiler allow the line below without errors or warnings? It seems that it should complain about the parameter mismatch in the "onSuccess" declaration and the definition.
I'm using Xcode 4.6 (LLVM 4.2)
void (^onSuccess)() = ^(AFHTTPRequestOperation *operation, id responseObject) {
};
Upvotes: 0
Views: 179
Reputation: 7720
This seems to work just like C function declarations. To Quote from the C99 standard:
(6.7.5.3/14) [...]The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied.[...]
Meaning, you can declare a function (and as it seems also a block) and not provide any information about parameters.
Upvotes: 2