• <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
            亚洲乱码精品久久久久..| 亚洲AV无码一区东京热久久| 亚洲国产精品久久久久网站 | 亚洲欧美伊人久久综合一区二区 | 国产成人精品久久免费动漫| 99久久国产亚洲高清观看2024| 久久久久久亚洲精品不卡| 久久综合狠狠综合久久| 久久免费视频1| 一本一道久久精品综合| 久久亚洲sm情趣捆绑调教| 国产精品午夜久久| 久久精品国产一区| 久久婷婷综合中文字幕| 国产欧美久久久精品| 亚洲伊人久久成综合人影院| 久久久人妻精品无码一区| 国产成人精品久久一区二区三区av| 久久天天日天天操综合伊人av| 久久国产精品99精品国产| 久久久久亚洲精品无码蜜桃| 久久久亚洲精品蜜桃臀| 亚洲国产天堂久久综合网站| 久久亚洲日韩精品一区二区三区| 久久男人AV资源网站| 97精品伊人久久久大香线蕉| 久久精品夜夜夜夜夜久久| 国产亚洲精品久久久久秋霞| 久久香蕉超碰97国产精品| 国产精品成人久久久| 青青草原综合久久大伊人导航| 无码国内精品久久人妻麻豆按摩| 九九99精品久久久久久| 99麻豆久久久国产精品免费| 久久人爽人人爽人人片AV| 一本色道久久HEZYO无码| 精品久久久无码人妻中文字幕| 久久精品国产亚洲av麻豆色欲| 无码精品久久久天天影视| 亚洲人成精品久久久久| 无码人妻久久一区二区三区蜜桃 |