20 Dec
2003
20 Dec
'03
2:31 a.m.
"Zack Weinberg"
It does, however, lead to a different problem:
if (condition) Py_DECREF (foo); else // oops, syntax error here
How so? This expands to if(condition) if(cond2)action1; else action2; else ... This is perfectly well-formed C, and it groups as my indentation suggests. There is no real problem with this macro. It is just gcc complaining falsely.
In general I consider it appropriate to wrap _all_ macros that don't return a value in do { ... } while (0), because that way you don't have to worry about which of them truly need it.
Hmm. Yes, this could be done - but it is unfortunate that this needs to be done only to silence gcc. Regards, Martin