• <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
            很黄很污的网站久久mimi色| 97久久国产综合精品女不卡| 久久96国产精品久久久| 久久不射电影网| 久久无码AV中文出轨人妻| 久久99热这里只有精品66| 成人久久久观看免费毛片| 久久亚洲欧洲国产综合| 国产人久久人人人人爽| 91久久精品国产免费直播| 亚洲AV日韩精品久久久久| 国产真实乱对白精彩久久| 亚洲乱码精品久久久久..| 久久久久亚洲av成人无码电影 | 久久综合香蕉国产蜜臀AV| 99久久综合狠狠综合久久| 亚洲色欲久久久综合网| 久久国产精品波多野结衣AV| 久久久久AV综合网成人| 亚洲国产精品成人久久蜜臀| 99久久伊人精品综合观看| 久久AV高清无码| 伊人久久大香线焦AV综合影院| 久久91精品综合国产首页| 91精品国产综合久久久久久| 国内高清久久久久久| 色综合合久久天天给综看| 99久久精品国产一区二区| 国产精品久久久久影院色| 日日躁夜夜躁狠狠久久AV| 国产精品99久久久精品无码| 欧美日韩精品久久免费| 欧美精品乱码99久久蜜桃| 亚洲精品tv久久久久| 久久影院亚洲一区| 亚洲一区精品伊人久久伊人| 久久经典免费视频| 久久久精品国产免大香伊| 亚洲va中文字幕无码久久不卡 | 久久久久国产一区二区三区| 国产精品伦理久久久久久|