• <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
            日韩一区二区三区视频久久| 97久久超碰国产精品2021| 久久免费国产精品一区二区| 亚洲国产成人久久精品影视| 亚洲天堂久久精品| 久久久久国产| 午夜不卡888久久| 伊人色综合久久天天人守人婷| 色欲久久久天天天综合网精品| 人人狠狠综合久久亚洲88| 热99RE久久精品这里都是精品免费 | 麻豆亚洲AV永久无码精品久久| 久久99精品综合国产首页| 伊人久久一区二区三区无码| 99久久精品费精品国产一区二区| 久久毛片免费看一区二区三区| 嫩草伊人久久精品少妇AV| 亚洲色欲久久久久综合网| 婷婷久久综合九色综合98| 无码精品久久久久久人妻中字| 久久国产午夜精品一区二区三区| 人妻精品久久无码专区精东影业| 性做久久久久久久久久久| 99久久国产综合精品成人影院| 欧美噜噜久久久XXX| 久久九九兔免费精品6| 日本加勒比久久精品| 久久久久一级精品亚洲国产成人综合AV区| 国产成人无码精品久久久性色| 精品人妻伦一二三区久久| 久久九九亚洲精品| 欧美一区二区精品久久| 97r久久精品国产99国产精| 久久亚洲美女精品国产精品| 少妇高潮惨叫久久久久久| 久久亚洲sm情趣捆绑调教| 久久精品亚洲AV久久久无码| 久久久久久久久久久精品尤物 | 色综合久久久久综合体桃花网| 亚洲色婷婷综合久久| 色偷偷久久一区二区三区|