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

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

  1. <legend id='Bszrq'><style id='Bszrq'><dir id='Bszrq'><q id='Bszrq'></q></dir></style></legend>

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

    <tfoot id='Bszrq'></tfoot>
      <bdo id='Bszrq'></bdo><ul id='Bszrq'></ul>

    1. 當(dāng)沒有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速

      In what ways do C++ exceptions slow down code when there are no exceptions thown?(當(dāng)沒有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速度?)

      <tfoot id='CwSwL'></tfoot>

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

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

                <legend id='CwSwL'><style id='CwSwL'><dir id='CwSwL'><q id='CwSwL'></q></dir></style></legend>
                本文介紹了當(dāng)沒有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速度?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我讀到使用 C++ 異常進(jìn)行異常處理有一些開銷,而不是檢查返回值.我只是在談?wù)摏]有拋出異常時(shí)產(chǎn)生的開銷.我還假設(shè)您需要實(shí)現(xiàn)實(shí)際檢查返回值并執(zhí)行適當(dāng)操作的代碼,無論與 catch 塊所做的操作等效.而且,將拋出異常對象的代碼與其中包含 45 個(gè)狀態(tài)變量的代碼進(jìn)行比較,并為每個(gè)錯(cuò)誤返回一個(gè)負(fù)整數(shù)的代碼也是不公平的.

                I have read that there is some overhead to using C++ exceptions for exception handling as opposed to, say, checking return values. I'm only talking about overhead that is incurred when no exception is thrown. I'm also assuming that you would need to implement the code that actually checks the return value and does the appropriate thing, whatever would be the equivalent to what the catch block would have done. And, it's also not fair to compare code that throws exception objects with 45 state variables inside to code that returns a negative integer for every error.

                我不是試圖僅僅基于哪個(gè)可能執(zhí)行得更快來構(gòu)建支持或反對 C++ 異常的案例.我聽說最近有人提出這樣的案例,一旦您考慮到檢查返回值和處理錯(cuò)誤所需的所有額外簿記代碼,使用異常的代碼應(yīng)該與基于返回代碼的代碼一樣快地運(yùn)行.我錯(cuò)過了什么?

                I'm not trying to build a case for or against C++ exceptions solely based on which one might execute faster. I heard someone make the case recently that code using exceptions ought to run just as fast as code based on return codes, once you take into account all the extra bookkeeping code that would be needed to check the return values and handle the errors. What am I missing?

                推薦答案

                某些 平臺(tái)和某些 編譯器上的異常處理會(huì)產(chǎn)生相關(guān)成本.

                There is a cost associated with exception handling on some platforms and with some compilers.

                也就是說,Visual Studio 在構(gòu)建 32 位目標(biāo)時(shí),將在每個(gè)具有非平凡析構(gòu)函數(shù)的局部變量的函數(shù)中注冊一個(gè)處理程序.基本上,它設(shè)置了一個(gè) try/finally 處理程序.

                Namely, Visual Studio, when building a 32-bit target, will register a handler in every function that has local variables with non-trivial destructor. Basically, it sets up a try/finally handler.

                gcc 和面向 64 位的 Visual Studio 采用的另一種技術(shù)僅在拋出異常時(shí)產(chǎn)生開銷(該技術(shù)涉及遍歷調(diào)用堆棧和表抬頭).在很少拋出異常的情況下,這實(shí)際上可以產(chǎn)生更高效的代碼,因?yàn)椴槐靥幚礤e(cuò)誤代碼.

                The other technique, employed by gcc and Visual Studio targeting 64-bits, only incurs overhead when an exception is thrown (the technique involves traversing the call stack and table lookup). In cases where exceptions are rarely thrown, this can actually lead to a more efficient code, as error codes don't have to be processed.

                這篇關(guān)于當(dāng)沒有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速度?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                When and how should I use exception handling?(我應(yīng)該何時(shí)以及如何使用異常處理?)
                Scope of exception object in C++(C++中異常對象的范圍)
                Catching exceptions from a constructor#39;s initializer list(從構(gòu)造函數(shù)的初始化列表中捕獲異常)
                Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區(qū)別)
                Should the exception thrown by boost::asio::io_service::run() be caught?(應(yīng)該捕獲 boost::asio::io_service::run() 拋出的異常嗎?)
                  <tbody id='DRVw9'></tbody>
                • <legend id='DRVw9'><style id='DRVw9'><dir id='DRVw9'><q id='DRVw9'></q></dir></style></legend>
                  <tfoot id='DRVw9'></tfoot>

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

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

                          主站蜘蛛池模板: 成人亚洲视频 | 成人黄色一级片 | 欧美69式性猛交 | 欧美精品色 | 午夜视频在线看 | 欧美日韩中文 | 三级av网站| 91免费福利视频 | 高潮毛片又色又爽免费 | 国产中文在线 | 国产精品自拍小视频 | 日韩欧美综合 | 丰满岳乱妇一区二区 | 久久精品1| 久久久一本 | 欧美性猛交xxxx黑人交 | 欧美精品一区二区三区四区 | 成年人视频在线播放 | 国产成人在线免费视频 | 在线成人小视频 | 国产美女自拍视频 | 亚洲视频在线播放 | 国产精品日韩在线 | 久久最新网址 | 日本美女性生活 | 欧美一二区 | 在线看片a| 一区二区三区蜜桃 | 婷婷天堂 | av青青草 | 久久久久久久网 | 91色交视频 | 国产成人精品一区二区三区福利 | 久久久午夜精品 | 欧美二三区 | 欧美777 | 国产一级18片视频 | a视频在线观看 | 黄色福利视频 | 成人高清| 中文字幕在线免费看 |