How can I avoid using exceptions in C++?

后端 未结 6 1782
臣服心动
臣服心动 2021-02-04 21:08

What techniques can I use to avoid exceptions in C++, as mentioned in Google\'s style guide?

6条回答
  •  不知归路
    2021-02-04 21:20

    I'm interested to know why one would want to avoid exceptions in C++ and what mechanism one would replace them with to deal with the reality of unexpected failure while still maintaining decent structure.

    Sure adding them to a existing codebase that doesn't use RAII type semantics is extremely costly - but if one is doing green field development then what alternative would you suggest and how are going to justify not using high quality libraries that do use exceptions vs. writing your own exception free / bug free alternatives?

提交回复
热议问题