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

  • <tfoot id='X9VS8'></tfoot>

    1. <legend id='X9VS8'><style id='X9VS8'><dir id='X9VS8'><q id='X9VS8'></q></dir></style></legend>
        <bdo id='X9VS8'></bdo><ul id='X9VS8'></ul>

      1. <small id='X9VS8'></small><noframes id='X9VS8'>

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

        如何捕捉空指針異常?

        How to catch the null pointer exception?(如何捕捉空指針異常?)
          <tbody id='UQQQM'></tbody>
        • <small id='UQQQM'></small><noframes id='UQQQM'>

          1. <i id='UQQQM'><tr id='UQQQM'><dt id='UQQQM'><q id='UQQQM'><span id='UQQQM'><b id='UQQQM'><form id='UQQQM'><ins id='UQQQM'></ins><ul id='UQQQM'></ul><sub id='UQQQM'></sub></form><legend id='UQQQM'></legend><bdo id='UQQQM'><pre id='UQQQM'><center id='UQQQM'></center></pre></bdo></b><th id='UQQQM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UQQQM'><tfoot id='UQQQM'></tfoot><dl id='UQQQM'><fieldset id='UQQQM'></fieldset></dl></div>
              <legend id='UQQQM'><style id='UQQQM'><dir id='UQQQM'><q id='UQQQM'></q></dir></style></legend>
                <bdo id='UQQQM'></bdo><ul id='UQQQM'></ul>
                1. <tfoot id='UQQQM'></tfoot>
                2. 本文介紹了如何捕捉空指針異常?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                    try {
                          int* p = 0;
                          *p = 1;
                      } catch (...) {
                          cout << "null pointer." << endl;
                      }
                  

                  我試圖捕捉這樣的異常,但它不起作用,有什么幫助嗎?

                  I tried to catch the exception like this but it doesn't work,any help?

                  推薦答案

                  C++ 中沒(méi)有空指針異常"這樣的東西.您可以捕獲的唯一異常是 throw 表達(dá)式顯式拋出的異常(另外,正如 Pavel 所指出的,一些標(biāo)準(zhǔn) C++ 異常由標(biāo)準(zhǔn) operator newdynamic_cast 等).C++ 中沒(méi)有其他例外.取消引用空指針、除以零等不會(huì)在 C++ 中產(chǎn)生異常,它會(huì)產(chǎn)生未定義行為.如果您希望在這種情況下拋出異常,您有責(zé)任手動(dòng)檢測(cè)這些條件并明確地執(zhí)行 throw.這就是它在 C++ 中的工作方式.

                  There's no such thing as "null pointer exception" in C++. The only exceptions you can catch, is the exceptions explicitly thrown by throw expressions (plus, as Pavel noted, some standard C++ exceptions thrown intrinsically by standard operator new, dynamic_cast etc). There are no other exceptions in C++. Dereferencing null pointers, division by zero etc. does not generate exceptions in C++, it produces undefined behavior. If you want exceptions thrown in cases like that it is your own responsibility to manually detect these conditions and do throw explicitly. That's how it works in C++.

                  您似乎正在尋找的其他任何東西都與 C++ 語(yǔ)言無(wú)關(guān),而是特定實(shí)現(xiàn)的功能.例如,在 Visual C++ 中,系統(tǒng)/硬件異常可以轉(zhuǎn)換"為 C++ 異常,但這種非標(biāo)準(zhǔn)功能是有代價(jià)的,通常不值得付出代價(jià).

                  Whatever else you seem to be looking for has noting to do with C++ language, but rather a feature of particular implementation. In Visual C++, for example, system/hardware exceptions can be "converted" into C++ exceptions, but there's a price attached to this non-standard functionality, which is not normally worth paying.

                  這篇關(guān)于如何捕捉空指針異常?的文章就介紹到這了,希望我們推薦的答案對(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í)以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對(duì)象的范圍)
                  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ū)別)
                  • <tfoot id='RGjIs'></tfoot>
                    <i id='RGjIs'><tr id='RGjIs'><dt id='RGjIs'><q id='RGjIs'><span id='RGjIs'><b id='RGjIs'><form id='RGjIs'><ins id='RGjIs'></ins><ul id='RGjIs'></ul><sub id='RGjIs'></sub></form><legend id='RGjIs'></legend><bdo id='RGjIs'><pre id='RGjIs'><center id='RGjIs'></center></pre></bdo></b><th id='RGjIs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RGjIs'><tfoot id='RGjIs'></tfoot><dl id='RGjIs'><fieldset id='RGjIs'></fieldset></dl></div>
                          <tbody id='RGjIs'></tbody>

                        <legend id='RGjIs'><style id='RGjIs'><dir id='RGjIs'><q id='RGjIs'></q></dir></style></legend>
                      • <small id='RGjIs'></small><noframes id='RGjIs'>

                          <bdo id='RGjIs'></bdo><ul id='RGjIs'></ul>

                            主站蜘蛛池模板: 中文字幕第二区 | 国产免费看 | 人人爽日日躁夜夜躁尤物 | 亚洲国产精品一区二区三区 | 亚洲欧美网 | 中文精品视频 | 99精品观看 | 亚洲综合色 | 自拍偷拍亚洲一区 | 亚洲综合精品 | 久久免费香蕉视频 | 一区二区视频在线观看 | 国产乱码精品1区2区3区 | 国产在线精品一区二区 | 成人免费视频网站在线观看 | 欧美一级二级视频 | 久久国产精品精品 | 一区二区三区在线 | 欧 | 国产一区二区不卡 | 有码在线 | 国产大毛片 | 视频一二三区 | 久久久www成人免费无遮挡大片 | 国产精品日韩欧美一区二区三区 | 国产这里只有精品 | 成人在线网址 | 精品久久久久久亚洲精品 | 国产高清在线精品一区二区三区 | 美女二区| 精品91久久| 国产视频一区在线 | 国产精品久久久久久久久图文区 | 91私密视频 | 欧产日产国产精品视频 | 亚洲精品天堂 | 欧美成人在线免费 | 国产午夜av片 | 久久逼逼 | 亚洲成人一区二区在线 | 国产高清精品在线 | 日批免费观看 |