开发者

Is there a list of c++11 standard library interfaces which require exceptions enabled?

From reading revision N3242 of the c++11 draft, it appears that some components of the standard library's interfaces (notably threading and locking) depend on exception handling.

S开发者_如何学Pythonince I do a lot of work with exceptions disabled, I am wondering which library components/features will be (practically or logically) unusable without exception handling enabled?


First of all (just as a reminder), disabling exceptions and RTTI are compiler specific extensions the Standard has no consideration for.

Since the Standard Library is usually tied to the compiler, it may be that your implementation of the Standard Library has been specifically designed to cope with this (and in particular, to cope with new returning null pointers instead of raising std::bad_alloc).

Therefore, what you ask for is non-sensical. Check the documentation of your own library for a complete list.

That being said, the Standard does guarantee that a number of operations will never throw. I don't know of any operation that swallows exceptions, I would suppose that most of them are actually safe to use as-is.

For example, all algorithms should be safe.

Still, once again, I can only recommend reading the documentation of your implementation.


This question is over one month old, and unanswered.

I am providing an answer which can be considered a community wiki, add to it as needed.

  • std::thread Section 30.2.2. Transitive. Abstraction implemented using native implementations.

  • std::mutex, std::recursive_mutex, std::timed_mutex, std::recursive_timed_mutex. Section 30.4.1, Intransitive if you supply your own exception free locking (via BasicLockable, Lockable, TimedLockable). Abstraction implemented using native implementations.

  • std::condition_variable Section 30.5. Transitive. Abstraction implemented using native implementations.

note: There will be more.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜