久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='X51J8'><tr id='X51J8'><dt id='X51J8'><q id='X51J8'><span id='X51J8'><b id='X51J8'><form id='X51J8'><ins id='X51J8'></ins><ul id='X51J8'></ul><sub id='X51J8'></sub></form><legend id='X51J8'></legend><bdo id='X51J8'><pre id='X51J8'><center id='X51J8'></center></pre></bdo></b><th id='X51J8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='X51J8'><tfoot id='X51J8'></tfoot><dl id='X51J8'><fieldset id='X51J8'></fieldset></dl></div>
  • <small id='X51J8'></small><noframes id='X51J8'>

      1. <legend id='X51J8'><style id='X51J8'><dir id='X51J8'><q id='X51J8'></q></dir></style></legend>
          <bdo id='X51J8'></bdo><ul id='X51J8'></ul>
      2. <tfoot id='X51J8'></tfoot>

        C++中異常對(duì)象的范圍

        Scope of exception object in C++(C++中異常對(duì)象的范圍)
          <bdo id='fohOt'></bdo><ul id='fohOt'></ul>

        • <small id='fohOt'></small><noframes id='fohOt'>

          1. <i id='fohOt'><tr id='fohOt'><dt id='fohOt'><q id='fohOt'><span id='fohOt'><b id='fohOt'><form id='fohOt'><ins id='fohOt'></ins><ul id='fohOt'></ul><sub id='fohOt'></sub></form><legend id='fohOt'></legend><bdo id='fohOt'><pre id='fohOt'><center id='fohOt'></center></pre></bdo></b><th id='fohOt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fohOt'><tfoot id='fohOt'></tfoot><dl id='fohOt'><fieldset id='fohOt'></fieldset></dl></div>

            <tfoot id='fohOt'></tfoot>
              <tbody id='fohOt'></tbody>
            <legend id='fohOt'><style id='fohOt'><dir id='fohOt'><q id='fohOt'></q></dir></style></legend>

                1. 本文介紹了C++中異常對(duì)象的范圍的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  C++中異常對(duì)象的作用域是什么?一旦執(zhí)行 catch 處理程序,它是否會(huì)超出范圍?另外,如果我創(chuàng)建了一個(gè)未命名的異常對(duì)象并拋出它,那么在捕獲該異常時(shí),是通過(guò)常量引用還是非常量引用來(lái)捕獲它有關(guān)系嗎?

                  What is the scope of the exception object in C++? does it go out of scope as soon as catch handler is executed? Also, if I create an unnamed exception object and throw it, then while catching that exception does it matter if I catch it by const reference or a non-const reference?

                  推薦答案

                  當(dāng)對(duì) throw 表達(dá)式求值時(shí),會(huì)根據(jù)表達(dá)式的值初始化一個(gè)異常對(duì)象.拋出的異常對(duì)象從 throw 表達(dá)式的靜態(tài)類型獲取其類型,忽略任何 constvolatile 限定符.對(duì)于類類型,這意味著執(zhí)行復(fù)制初始化.

                  When a throw expression is evaluated, an exception object is initialized from the value of the expression. The exception object which is thrown gets its type from the static type of the throw expression ignoring any const and volatile qualifiers. For class types this means that copy-initialization is performed.

                  異常對(duì)象的范圍在發(fā)生拋出的塊的范圍之外.可以把它想象成一個(gè)特殊的異常區(qū)域,遠(yuǎn)離本地對(duì)象所在的正常調(diào)用堆棧的一側(cè).

                  The exception object's scope is outside of the scope of the block where the throw occurs. Think of it as living in a special exception area off to one side of the normal call stack where local objects live.

                  catch 塊中,用捕獲的異常對(duì)象初始化的名稱是用這個(gè)異常對(duì)象初始化的,而不是 throw 的參數(shù),即使這是一個(gè)左值.

                  Inside a catch block, the name initialized with the caught exception object is initialized with this exception object and not the argument to throw, even if this was an lvalue.

                  如果你通過(guò)非常量引用catch,那么你可以改變異常對(duì)象,但不能改變它的初始化對(duì)象.如果您以通過(guò)值或常量引用(const_cast 暫且不提)捕獲的方式重新拋出異常,您可以改變程序的行為.

                  If you catch via non-const reference, then you can mutate the exception object, but not what it was initialized from. You can alter the behaviour of the program if you re-throw the exception in ways that you couldn't if you caught by value or const reference (const_casts aside).

                  當(dāng)最后一個(gè)沒(méi)有通過(guò)重新拋出(即無(wú)參數(shù)拋出表達(dá)式評(píng)估)退出的 catch 塊完成時(shí),異常對(duì)象被銷毀.

                  The exception object is destroyed when the last catch block that does not exit via a re-throw (i.e. a parameterless throw expression evaluation) completes.

                  這篇關(guān)于C++中異常對(duì)象的范圍的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當(dāng)沒(méi)有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對(duì) const 的引用?)
                  When and how should I use exception handling?(我應(yīng)該何時(shí)以及如何使用異常處理?)
                  Catching exceptions from a constructor#39;s initializer list(從構(gòu)造函數(shù)的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說(shuō)明符 C++11 noexcept 之間的區(qū)別)
                  Should the exception thrown by boost::asio::io_service::run() be caught?(應(yīng)該捕獲 boost::asio::io_service::run() 拋出的異常嗎?)
                  <i id='y94Ij'><tr id='y94Ij'><dt id='y94Ij'><q id='y94Ij'><span id='y94Ij'><b id='y94Ij'><form id='y94Ij'><ins id='y94Ij'></ins><ul id='y94Ij'></ul><sub id='y94Ij'></sub></form><legend id='y94Ij'></legend><bdo id='y94Ij'><pre id='y94Ij'><center id='y94Ij'></center></pre></bdo></b><th id='y94Ij'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='y94Ij'><tfoot id='y94Ij'></tfoot><dl id='y94Ij'><fieldset id='y94Ij'></fieldset></dl></div>
                  • <bdo id='y94Ij'></bdo><ul id='y94Ij'></ul>

                            <tbody id='y94Ij'></tbody>
                          <legend id='y94Ij'><style id='y94Ij'><dir id='y94Ij'><q id='y94Ij'></q></dir></style></legend>

                          <small id='y94Ij'></small><noframes id='y94Ij'>

                        • <tfoot id='y94Ij'></tfoot>
                            主站蜘蛛池模板: 极品淫少妇 | 久久天堂网 | 午夜在线观看视频网站 | 亚洲特级毛片 | 国产精品主播一区二区 | 国产精品99精品久久免费 | 在线免费观看黄色片 | 天天操天天操 | 一区二区三区在线播放 | 久久精品国产一区 | 亚洲视频一区二区三区四区 | 日韩毛片视频 | 国产免费无遮挡 | 91性高潮久久久久久久久 | 黄色片国产 | 四虎在线免费视频 | 亚洲二级片 | 亚洲一区在线看 | 欧美69视频 | 日韩伦理一区二区 | 日韩精品在线视频 | 中文字幕在线观看日本 | 福利网站在线观看 | 午夜美女福利 | 亚洲一区二区三区在线播放 | 小日子的在线观看免费第8集 | 午夜激情在线观看 | 久久精品二区 | 日日干天天射 | 成人精品一区二区三区 | 日本美女一级片 | 国产区在线观看 | 人人超碰人人 | 福利片国产 | 一区二区影视 | 亚洲国产精品久久久久久久 | 午夜精品久久久久久 | 日韩视频一区 | 黄色免费视频网站 | 黄色福利视频 | 成人在线免费观看网站 |