久久久久久久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. 當沒有異常時,C++ 異常會以何種方式減慢代碼速

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

      <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>
                本文介紹了當沒有異常時,C++ 異常會以何種方式減慢代碼速度?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我讀到使用 C++ 異常進行異常處理有一些開銷,而不是檢查返回值.我只是在談論沒有拋出異常時產生的開銷.我還假設您需要實現實際檢查返回值并執行適當操作的代碼,無論與 catch 塊所做的操作等效.而且,將拋出異常對象的代碼與其中包含 45 個狀態變量的代碼進行比較,并為每個錯誤返回一個負整數的代碼也是不公平的.

                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.

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

                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?

                推薦答案

                某些 平臺和某些 編譯器上的異常處理會產生相關成本.

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

                也就是說,Visual Studio 在構建 32 位目標時,將在每個具有非平凡析構函數的局部變量的函數中注冊一個處理程序.基本上,它設置了一個 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 采用的另一種技術僅在拋出異常時產生開銷(該技術涉及遍歷調用堆棧和表抬頭).在很少拋出異常的情況下,這實際上可以產生更高效的代碼,因為不必處理錯誤代碼.

                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.

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

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

                相關文檔推薦

                Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                Scope of exception object in C++(C++中異常對象的范圍)
                Catching exceptions from a constructor#39;s initializer list(從構造函數的初始化列表中捕獲異常)
                Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區別)
                Should the exception thrown by boost::asio::io_service::run() be caught?(應該捕獲 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>

                          主站蜘蛛池模板: 欧美日韩综合精品 | 97精品超碰一区二区三区 | 亚洲国产成人在线观看 | 欧美最猛性xxxxx亚洲精品 | 亚洲精品女优 | 国产激情网 | 日韩成人在线免费视频 | 国产日韩一区二区三区 | 九九久久国产精品 | 亚洲精品2区 | 国产xxxx岁13xxxxhd | 亚洲欧美日韩国产综合 | 国产精品一区二区三区在线 | 精品亚洲一区二区三区四区五区高 | 亚洲精品视频导航 | 欧美一区二区三区四区视频 | 蜜桃在线播放 | 精品国产欧美一区二区三区成人 | 色播久久| 久久免费视频2 | 亚洲精品一区二区三区在线观看 | 色资源在线观看 | 欧美一区二区三区久久精品视 | 免费一区二区三区 | 亚洲精品456| 国产精品福利网 | 国产乱码久久久久久 | 欧美激情精品久久久久久免费 | 不卡一区 | 国产一区二区三区四区区 | 亚洲精品国产精品国自产在线 | 国产高清视频一区二区 | 欧美日韩一本 | 国产高清毛片 | 一区二区三区四区不卡视频 | 国产精品一区二区av | 91在线看网站 | 中文字幕 在线观看 | 亚洲一区二区三区久久 | 操夜夜| 91五月天 |