Wrap a function call to F such that it throws an error on invalid return.
Many functions in the C and POSIX standards return a void*
and signal an error with value that is 0
or (void*)-1
. 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_NEG for a similar macro that checks if the return value is negative
Definition at line 487 of file p99_try.h.