how to pass block as a macro's argument in objective-c?
In my code i have a lot of code like: if (block) block(....) So I want to define a macro, something like #define safetyCall(block, ...) if((block)) {block(##__VA_ARGS__)}; But i couldn't get it to work. Any idea? You don't need the ## and the ; needs moving: #define safetyCall(block, ...) if((block)) { block(__VA_ARGS__); } This can run into issues if your block is inline and contains code that has a series of comma separated strings, etc. Example: safetyCall(^void() { NSArray *foo = @[@"alice", "bob"]; }; The compiler will complain about "Expected ']' or '.'" and "Expected identifier or '('".