9.13.3.5.5. Define ENSURE_OR_RETURN

9.13.3.5.5.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.