we have frequently repeated lines in the code that check the return status of the function, and if it returns immediately with the status. I thought about defining a macro for this:
#define RETURN_IF_FAILED(x) { int stat = (x); if (FAILED(stat)) return stat; }
A local variable is that a parameter xcan be a function call.
As I know, there are some strange artifacts of using macros, and I don't really understand them, I would like to ask if there are any problems with this macro. Thank.
(and please do not suggest using exceptions - I hate this style myself, but the way it is done here)
source
share