0

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) {
};
1
  • Shows us the original typedef. Commented Feb 6, 2013 at 2:30

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Also nearly a duplicate of stackoverflow.com/questions/5075530/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.