Search code examples
cc-preprocessorparentheses

Is there a macro that expands to return without parentheses?


I want to use a macro like this

#define  Return(x)   {call_my_function(); return (x);}

is there any way to use or declare a macro without parentheses, so I can use it like a real return call and not a function? For example:

BOOL my_func() {
    code....
    Return FALSE;
}

Solution

  • You could do something horrific as

    #define  Return for (call_my_function(); ;) return
    

    Edit: Changed to Daniel's version for the nice smiley that makes. And Jim's idea of "overloading" return directly is valid and even more horrific ;)