QH_RET_ERRNO()

Updated: April 19, 2023

A macro that sets errno and returns its value

Synopsis:

#include <qh/error.h>
#define QH_RET_ERRNO(errno)

Arguments:

errno
The standard errno to set errno to and then return with.

Library:

qh

Description:

Because this is a macro that calls return, the invoking function actually returns when the macro is executed. The invoking function is expected to have an int as its return type.

Because what is passed in to the macro is only evaluated once, it is safe to execute operations as part of calling the macro.