P99

◆ P99_THROW_CALL_NEG

#define P99_THROW_CALL_NEG (   F,
  E,
  ... 
)    P00_THROW_CALL_NEG(F, E, __VA_ARGS__)

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

Many functions in the C and POSIX standards return an int and signal an error with a negative value. They then 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
the value of the call to the function if that was successful. Never returns if it wasn't.
See also
P99_THROW_CALL_ZERO for a similar macro that checks if the return value is 0
P99_THROW_CALL_VOIDP for a similar macro that checks a pointer return value

Definition at line 408 of file p99_try.h.