Some people disagree with me about this, but I use goto's. Inside each function at the end, I have a block at the end that looks like this
if (0)
{
ERROR:
// Handle errors, and exit/return after potentially freeing resources
}
if (something_bad) goto ERROR; elses .
goto's, . , goto, :
#define LOCAL_ASSERT(COND) if (COND) { \
\
}
, #undef LOCAL_ASSERT . , .
LOCAL_ASSERT(cond) .
:, , , . , ( ). , - .
if (error) goto ERROR;
LOCAL_ASSERT(cond);
Elses , .