• <legend id='inMhN'><style id='inMhN'><dir id='inMhN'><q id='inMhN'></q></dir></style></legend>

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

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

        当我的 lua 代码抛出错误时,为什么我不能捕获 luabind::error 异常?

        Why can#39;t I catch a luabind::error exception when my lua code throws an error?(当我的 lua 代码抛出错误时,为什么我不能捕获 luabind::error 异常?)

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

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

              • <bdo id='yh8m7'></bdo><ul id='yh8m7'></ul>

              • <legend id='yh8m7'><style id='yh8m7'><dir id='yh8m7'><q id='yh8m7'></q></dir></style></legend>
                  <tbody id='yh8m7'></tbody>
                  本文介绍了当我的 lua 代码抛出错误时,为什么我不能捕获 luabind::error 异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当你从 c++ 调用一个 LUA 函数并且有一个运行时错误 LuaBind 抛出一个 luabind::error 异常,你可以捕获它然后读取堆栈以查看错误是什么.我的调试器肯定会捕获此异常,但是当我让调试器继续运行时,程序会立即终止,而不是在我的代码中捕获异常.

                  When you call a LUA function from c++ and there is a runtime error LuaBind throws a luabind::error exception that you can catch and then read the stack to see what the error was. My debugger definitely catches this exception but when I let the debugger continue, instead of the exception being caught in my code the program immediately terminates.

                  异常在来自析构函数 ~proxy_member_void_caller() 的 LuaBind 包含文件中的call_member.hpp"中抛出.

                  The exception is thrown in "call_member.hpp" in the LuaBind include files from the destructor ~proxy_member_void_caller().

                  问题出现在简单的测试代码中.我使用 Xcode 5 和 LuaBind 0.9.1.

                  The problem occurs with simple test code. I am using Xcode 5 with LuaBind 0.9.1.

                  推荐答案

                  原来是在析构函数中抛出异常的坏习惯.C++11 的析构函数是隐式的noexcept(true),所以如果发生异常,程序就会终止.LuaBind 在析构函数中使用异常,因此在我的现代编译器中程序终止.将方法签名编辑为:

                  It turns out that it is bad practice to throw exceptions in destructors. With C++11 destructors are implicitly noexcept(true), so if an exception occurs the program terminates. LuaBind uses exceptions in destructors, so on my modern compiler the program terminated. Editing the method signature to:

                  ~proxy_member_void_caller() noexcept(false) {}
                  

                  允许您在 c++11 中捕获来自 LuaBind 的异常.

                  allows you to catch exceptions from LuaBind in c++11.

                  这篇关于当我的 lua 代码抛出错误时,为什么我不能捕获 luabind::error 异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)

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

                    • <bdo id='O700r'></bdo><ul id='O700r'></ul>
                    • <legend id='O700r'><style id='O700r'><dir id='O700r'><q id='O700r'></q></dir></style></legend>
                              <tbody id='O700r'></tbody>
                            <tfoot id='O700r'></tfoot>

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