In C++ what are the benefits of using exceptions and try / catch instead of just returning an error code?

后端 未结 13 851
遥遥无期
遥遥无期 2020-12-04 19:58

I\'ve programmed C and C++ for a long time and so far I\'ve never used exceptions and try / catch. What are the benefits of using that instead of just having functions retur

13条回答
  •  独厮守ぢ
    2020-12-04 20:29

    Exception handling is useful because it makes it easy to separate the error handling code from the code written to handle the function of the program. This makes reading and writing the code easier.

提交回复
热议问题