9.13.3.5.6. Define ENSURE_OR_RETURN_ON_ERROR¶
Defined in File nxEnsure.h
9.13.3.5.6.1. Define Documentation¶
-
ENSURE_OR_RETURN_ON_ERROR(CONDITION, RETURN_VALUE)¶ If condition fails, return
int SomeAPI() { ... status = Operation1(); ENSURE_OR_RETURN_ON_ERROR(0 == status, ERR_FAIL); status = Operation2(); ENSURE_OR_RETURN_ON_ERROR(0 == status, ERR_NOT_ENOUGH_SPACE); ... return 0; }- Warning
This macro introduces system of mutliple returns from a function which is not easy to debug/trace through and hence not recommended.
