久久久久久久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>

                            主站蜘蛛池模板: 免费在线看a | 黄色一级视频在线观看 | 四虎海外| 91综合在线 | 日韩视频免费看 | 精品国产三级 | 在线观看欧美日韩视频 | 九九久久精品视频 | 亚洲欧美日韩一区二区 | 日韩成人在线免费观看 | 香蕉视频一区二区 | 少妇久久久 | 国产精品自拍av | 黄色网av | 亚洲一区在线播放 | 日韩三级中文字幕 | 亚洲毛片av| 欧美亚洲国产精品 | 亚洲国产精品一区二区三区 | 91av免费观看 | 亚洲在线免费 | 国产又爽又黄免费视频 | 狠狠撸狠狠干 | 欧洲性视频 | 国产日韩综合 | av一区二区三区在线观看 | 日韩视频二区 | 亚洲一区二区三区在线 | 久久精品久久久久 | 精品免费观看 | 国产裸体永久免费视频网站 | 完全免费av | 国产1区2区| 午夜视频免费看 | 999毛片 | 成人免费看片' | 国产日韩av在线 | 久久免费看视频 | 国产女优在线 | 久久视频一区 | 欧美激情综合五月色丁香 |