11.12.3.6.15. Define ENSURE_OR_RETURN

11.12.3.6.15.1. Define Documentation

ENSURE_OR_RETURN(CONDITION)

If condition fails, return

void SomeAPI()
{
    ...

    status = Operation1();
    ENSURE_OR_RETURN(0 == status);

    status = Operation2();
    ENSURE_OR_RETURN(0 == status);

    ...

    return;
}

Warning

This macro introduces system of mutliple returns from a function which is not easy to debug/trace through and hence not recommended.