How can I avoid using exceptions in C++?

后端 未结 6 1784
臣服心动
臣服心动 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:46

    The style guide says they "don't use exceptions" which is just that - they don't throw them and don't call anything that could throw them (for example, they would use the new(std::nothrow) instead of usual new because the latter will throw bad_alloc when it fails to allocate memory.

提交回复
热议问题