• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 9, comments - 0, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理
            Depending on the precise conditions under which such pairs of simultaneously active exceptions arise, program execution either terminates or yields undefined behavior. In this example, it yields undefined behavior.
            C++ does not like destructors that emit exceptions!
            #include <iostream>
            #include <vector>
            struct Exception
            {
                Exception(){std::cout << "Exception Constructor" << std::endl;}
                ~Exception(){std::cout << "Exception Destructor" << std::endl;}
            };
            class Widget {
            public:
              ~Widget() {std::cout << "Widget Destructor" << std::endl; throw Exception();
              }        //this might emit an exception
              void print(){std::cout << "print" << std::endl;}
            };
                            
            void doSomething();
            int main()
            {
                doSomething();
            }
            void doSomething()
            {
              std::vector<Widget> v;
              v.push_back(Widget());
              v.push_back(Widget());
              v.push_back(Widget());
              v.push_back(Widget());
              std::vector<Widget>::iterator it = v.begin();
              while(it != v.end())
              {
                std::cout << "end" << std::endl;
                (*it).print();
                it++;
              }
            }
            complie with g++
            [shangtang@BTSOM-1 study]$ ./a.out
            Widget Destructor
            Exception Constructor
            terminate called after throwing an instance of 'Exception'
            Aborted (core dumped)
            There are two primary ways to avoid the trouble.

               1, Terminate the program if catch a exception, typically by calling std::abort (cstdlib)
              2, 
            Swallow the exception if catch a exception, print a log
            高清免费久久午夜精品| 久久青青草原国产精品免费| 人妻系列无码专区久久五月天| 久久久久成人精品无码| 奇米影视7777久久精品人人爽| 亚洲国产精品一区二区久久hs | 久久99精品国产一区二区三区| 国产69精品久久久久99| 国产一区二区久久久| 久久91精品国产91久久户| 噜噜噜色噜噜噜久久| 国产日韩久久免费影院| WWW婷婷AV久久久影片| 久久精品人妻中文系列| 国产免费久久精品丫丫| 国产精品岛国久久久久| 少妇高潮惨叫久久久久久| 亚洲AV伊人久久青青草原| 亚洲国产成人久久综合碰碰动漫3d| 久久久一本精品99久久精品88| 久久精品国产亚洲精品| 亚洲欧美精品伊人久久| 久久久久亚洲AV无码专区体验 | 99久久无色码中文字幕人妻| 国产AⅤ精品一区二区三区久久| 色婷婷综合久久久久中文| 少妇人妻综合久久中文字幕| 亚洲国产精品成人AV无码久久综合影院 | 成人久久免费网站| 无码国内精品久久综合88| 亚洲精品成人久久久| 久久九九久精品国产免费直播| 国产免费久久久久久无码| 久久国产免费| 亚洲美日韩Av中文字幕无码久久久妻妇 | 91精品国产综合久久精品| 久久99精品国产自在现线小黄鸭| 欧洲成人午夜精品无码区久久| 精品综合久久久久久97| 一本色道久久88精品综合| 久久精品无码专区免费东京热 |