Muchin
Muchin

Reputation: 4997

Objective-C Block type as return value

How do I write the following:

typedef void (^T)(void);
T f() {
    return ^{};
}

without the typedef?

Upvotes: 14

Views: 4268

Answers (1)

kennytm
kennytm

Reputation: 523234

void (^f())(void) { 
  return ^{};
}

You'd better keep the typedef as the return type is not easy to understand in this form.

Upvotes: 33

Related Questions