Any good idioms for error handling in straight C programs?

后端 未结 12 1514
梦如初夏
梦如初夏 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 15:02

    You should check out what DirectX has done with the HRESULT - it's basically this. There's a reason that the exception came into being. Alternatively, if you run on Win32, they have SEH which runs in C programs.

提交回复
热议问题