pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<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="r0nu0xv" 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++中異常對象的范圍

        Scope of exception object in C++(C++中異常對象的范圍)
          <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="it3ezxa" 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++中異常對象的范圍的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  C++中異常對象的作用域是什么?一旦執行 catch 處理程序,它是否會超出范圍?另外,如果我創建了一個未命名的異常對象并拋出它,那么在捕獲該異常時,是通過常量引用還是非常量引用來捕獲它有關系嗎?

                  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?

                  推薦答案

                  當對 throw 表達式求值時,會根據表達式的值初始化一個異常對象.拋出的異常對象從 throw 表達式的靜態類型獲取其類型,忽略任何 constvolatile 限定符.對于類類型,這意味著執行復制初始化.

                  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.

                  異常對象的范圍在發生拋出的塊的范圍之外.可以把它想象成一個特殊的異常區域,遠離本地對象所在的正常調用堆棧的一側.

                  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 塊中,用捕獲的異常對象初始化的名稱是用這個異常對象初始化的,而不是 throw 的參數,即使這是一個左值.

                  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.

                  如果你通過非常量引用catch,那么你可以改變異常對象,但不能改變它的初始化對象.如果您以通過值或常量引用(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).

                  當最后一個沒有通過重新拋出(即無參數拋出表達式評估)退出的 catch 塊完成時,異常對象被銷毀.

                  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.

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

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

                  相關文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                  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() 拋出的異常嗎?)
                  <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="grypayh" 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>
                            主站蜘蛛池模板: 广东成考网-广东成人高考网| 深圳希玛林顺潮眼科医院(官网)│深圳眼科医院│医保定点│香港希玛林顺潮眼科中心连锁品牌 | 酒吧霸屏软件_酒吧霸屏系统,酒吧微上墙,夜场霸屏软件,酒吧点歌软件,酒吧互动游戏,酒吧大屏幕软件系统下载 | 北京晚会活动策划|北京节目录制后期剪辑|北京演播厅出租租赁-北京龙视星光文化传媒有限公司 | 热镀锌槽钢|角钢|工字钢|圆钢|H型钢|扁钢|花纹板-天津千百顺钢铁贸易有限公司 | 蒜肠网-动漫,二次元,COSPLAY,漫展以及收藏型模型,手办,玩具的新媒体.(原变形金刚变迷TF圈) | 广东佛电电器有限公司|防雷开关|故障电弧断路器|智能量测断路器 广东西屋电气有限公司-广东西屋电气有限公司 | 大型工业风扇_工业大风扇_大吊扇_厂房车间降温-合昌大风扇 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 钢衬四氟管道_钢衬四氟直管_聚四氟乙烯衬里管件_聚四氟乙烯衬里管道-沧州汇霖管道科技有限公司 | 烘干设备-热泵烘干机_广东雄贵能源设备有限公司 | 便携式谷丙转氨酶检测仪|华图生物科技百科| SDG吸附剂,SDG酸气吸附剂,干式酸性气体吸收剂生产厂家,超过20年生产使用经验。 - 富莱尔环保设备公司(原名天津市武清县环保设备厂) | 免联考国际MBA_在职MBA报考条件/科目/排名-MBA信息网 | 东莞螺丝|东莞螺丝厂|东莞不锈钢螺丝|东莞组合螺丝|东莞精密螺丝厂家-东莞利浩五金专业紧固件厂家 | 耙式干燥机_真空耙式干燥机厂家-无锡鹏茂化工装备有限公司 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | 泰兴市热钻机械有限公司-热熔钻孔机-数控热熔钻-热熔钻孔攻牙一体机 | 淄博不锈钢无缝管,淄博不锈钢管-鑫门物资有限公司 | 河南砖机首页-全自动液压免烧砖机,小型砌块水泥砖机厂家[十年老厂] | 亿立分板机_曲线_锯片式_走刀_在线式全自动_铣刀_在线V槽分板机-杭州亿协智能装备有限公司 | 二手Sciex液质联用仪-岛津气质联用仪-二手安捷伦气质联用仪-上海隐智科学仪器有限公司 | 无刷电机_直流无刷电机_行星减速机-佛山市藤尺机电设备有限公司 无菌检查集菌仪,微生物限度仪器-苏州长留仪器百科 | 塑胶跑道施工-硅pu篮球场施工-塑胶网球场建造-丙烯酸球场材料厂家-奥茵 | 电子书导航网_电子书之家_电子书大全_最新电子书分享发布平台 | 护栏打桩机-打桩机厂家-恒新重工| 3D全息投影_地面互动投影_360度立体投影_水幕灯光秀 | 广东银虎 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 高博医疗集团上海阿特蒙医院 | 碳纤维布-植筋胶-灌缝胶-固特嘉加固材料公司 | 反渗透水处理设备|工业零排放|水厂设备|软化水设备|海南净水设备--海南水处理设备厂家 | 苏州伊诺尔拆除公司_专业酒店厂房拆除_商场学校拆除_办公楼房屋拆除_家工装拆除拆旧 | 水质传感器_水质监测站_雨量监测站_水文监测站-山东水境传感科技有限公司 | 3d可视化建模_三维展示_产品3d互动数字营销_三维动画制作_3D虚拟商城 【商迪3D】三维展示服务商 广东健伦体育发展有限公司-体育工程配套及销售运动器材的体育用品服务商 | TPE_TPE热塑性弹性体_TPE原料价格_TPE材料厂家-惠州市中塑王塑胶制品公司- 中塑王塑胶制品有限公司 | RS系列电阻器,RK_RJ启动调整电阻器,RQ_RZ电阻器-上海永上电器有限公司 | 【MBA备考网】-2024年工商管理硕士MBA院校/报考条件/培训/考试科目/提前面试/考试/学费-MBA备考网 | 化工ERP软件_化工新材料ERP系统_化工新材料MES软件_MES系统-广东顺景软件科技有限公司 | 济南铝方通-济南铝方通价格-济南方通厂家-山东鲁方通建材有限公司 | 脱硝喷枪-氨水喷枪-尿素喷枪-河北思凯淋环保科技有限公司 | 幂简集成 - 品种超全的API接口平台, 一站搜索、试用、集成国内外API接口 | 光环国际-新三板公司_股票代码:838504|