nothrow or exception?

后端 未结 6 669
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 01:32

I am a student and I have small knowledge on C++, which I try to expand. This is more of a philosophical question.. I am not trying to implement something.

Since

6条回答
  •  死守一世寂寞
    2021-01-05 02:07

    In Symbian C++ it works the other way around. If you want an exception thrown when OOM you have to do

    T* t = new(ELeave) T();
    

    And you're right about the logic of throwing a new exception when OOM being strange. A scenario that is manageable suddenly becomes a program termination.

提交回复
热议问题