P99

◆ P99_THROW_CALL_ZERO

#define P99_THROW_CALL_ZERO (   F,
  E,
  ... 
)    p00_throw_call_zero(F(__VA_ARGS__), E, p00_unwind_top, P99_STRINGIFY(__LINE__), __func__, #F ", non-zero return")

Wrap a function call to F such that it throws an error on failure.

Many functions in the C and POSIX standards return an int or errno_t only for the purpose of signaling an error and provide an error code in errno. This wrapper makes this transparent such that it ensures that the error code is always checked, and if an error occurs the value of errno is thrown.

Returns
0 if the call was successful. Never returns if it wasn't.
See also
P99_THROW_CALL_NEG for a similar macro that checks if the return value is negative
P99_THROW_CALL_VOIDP for a similar macro that checks a pointer return value

Definition at line 310 of file p99_try.h.