views:

38

answers:

1

How do I write the following:

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

without the typedef?

+2  A: 
void (^f())(void) { 
  return ^{};
}

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

KennyTM
What's the rationale for this strangeness? The function parameters are inside the return type?
Muchin
@Muchin: http://stackoverflow.com/questions/89056/how-do-you-read-c-declarations
KennyTM