开发者

Should I ever use __throw_logic_error?

I've stumbled upon a piece of code that uses a function st开发者_StackOverflow社区d::__throw_logic_error to throw exceptions. This function is declared in functexcept.h and apparently does the same as throw logic_error(...). Is there a difference? What is the function for? When, if at all, should I prefer it?

Thank you.


No, don't use it (unless you really know what you're doing). It's internal to the implementation (as all __ names are).


In general, you shouldn't use it.

The two underscores at the beginning of the name are an indication that it's a compiler-specific addition, and probably it's not even meant for "public" use, but just as a helper for internals of the standard library (I suspect that it's there to support e.g. using the library without exceptions, but I'm just guessing).

Just use throw.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜