Any good idioms for error handling in straight C programs?

后端 未结 12 1537
梦如初夏
梦如初夏 2020-12-23 14:19

Getting back in to some C work.

Many of my functions look like this:

int err = do_something(arg1, arg2, arg3, &result);

With th

12条回答
  •  无人及你
    2020-12-23 14:56

    If error codes are boolean, then try the simpler code below:

    return func1() && func2() && func3()
    

提交回复
热议问题