9.13.3.5.2. Define ENSURE_OR_EXIT_WITH_STATUS_ON_ERROR¶
Defined in File nxEnsure.h
9.13.3.5.2.1. Define Documentation¶
-
ENSURE_OR_EXIT_WITH_STATUS_ON_ERROR(CONDITION, STATUS, RETURN_VALUE)¶ If condition fails, goto quit with return value status updated.
int SomeAPI() { int status = 0; ... value = Operation1(); ENSURE_OR_QUIT_WITH_STATUS_ON_ERROR(0 == value, status, ERR_FAIL); value = Operation2(); ENSURE_OR_QUIT_WITH_STATUS_ON_ERROR(0 == value, status, ERR_NOT_ENOUGH_SPACE); ... quit: return status; }- Warning
This macro introduces system of mutliple returns from a function which is not easy to debug/trace through and hence not recommended.
