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

<legend id='dySqz'><style id='dySqz'><dir id='dySqz'><q id='dySqz'></q></dir></style></legend>

      <tfoot id='dySqz'></tfoot>

      1. <i id='dySqz'><tr id='dySqz'><dt id='dySqz'><q id='dySqz'><span id='dySqz'><b id='dySqz'><form id='dySqz'><ins id='dySqz'></ins><ul id='dySqz'></ul><sub id='dySqz'></sub></form><legend id='dySqz'></legend><bdo id='dySqz'><pre id='dySqz'><center id='dySqz'></center></pre></bdo></b><th id='dySqz'></th></span></q></dt></tr></i><div id='dySqz'><tfoot id='dySqz'></tfoot><dl id='dySqz'><fieldset id='dySqz'></fieldset></dl></div>
          <bdo id='dySqz'></bdo><ul id='dySqz'></ul>
      2. 为什么空基类优化 (EBO) 在 MSVC 中不起作用?

        Why is the empty base class optimization (EBO) is not working in MSVC?(为什么空基类优化 (EBO) 在 MSVC 中不起作用?)
        <legend id='bBczu'><style id='bBczu'><dir id='bBczu'><q id='bBczu'></q></dir></style></legend>

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

          <tbody id='bBczu'></tbody>
          <bdo id='bBczu'></bdo><ul id='bBczu'></ul>

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

                  本文介绍了为什么空基类优化 (EBO) 在 MSVC 中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  为什么在 Visual C++ 中没有完全应用空基类优化 (EBO)?

                  Why is the empty base class optimization (EBO) not being fully applied in Visual C++?

                  如果我有很多基类,有什么办法可以帮助编译器做这个优化吗?

                  If I have a lot of base classes, is there any way for me to help the compiler make this optimization?

                  #include <iostream>
                  
                  struct T1 { };
                  struct T2 { };
                  struct T3 { };
                  struct T4 { };
                  struct T5 { };
                  struct T6 { };
                  
                  struct Test : T1, T2, T3, T4, T5, T6 { };
                  
                  int main() { std::cout << sizeof(Test); }   // Prints 5
                  

                  推荐答案

                  这是 Visual C++ 编译器中的一个长期存在的错误.当一个类派生自多个空基类时,只会使用空基优化(EBO)对初始空基类进行优化.

                  This is a longstanding bug in the Visual C++ compiler. When a class derives from multiple empty base classes, only the initial empty base class will be optimized using the empty base optimization (EBO).

                  此问题已于 2006 年在 Microsoft Connect 上报告:空基优化无法正常工作. 目前,Microsoft Connect 上看不到旧错误.有人告诉我这是一个临时问题,但我不知道什么时候会得到解决.同时,以下是 Jonathan Caves 对错误的回应,他是 Visual C++ 编译器团队的开发人员之一:

                  This issue was reported on Microsoft Connect in 2006: Empty Base Optimization Not Working Properly. At the moment, old bugs are not visible on Microsoft Connect. I am told that this is a temporary issue, though I do not know when it will be resolved. In the meantime, the following is the response to the bug from Jonathan Caves, who is one of the developers on the Visual C++ compiler team:

                  嗨:不幸的是,尽管这是 Visual C++ 对象模型中的一个错误,但我们目前无法修复它,因为修复它可能会破坏许多现有程序,因为对象的大小会发生变化.希望将来我们可以解决这个问题,但不能在产品的下一个版本中解决.

                  Hi: unfortunately even though this is a bug in the Visual C++ object model we are unable to fix it at this time given that fixing it would potentially break a lot of existing programs as the sizes of objects would change. Hopefully in the future we may be able to address this issue but not for the next release of the product.

                  感谢您报告问题.

                  这篇关于为什么空基类优化 (EBO) 在 MSVC 中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Consistent pseudo-random numbers across platforms(跨平台一致的伪随机数)
                  Vary range of uniform_int_distribution(改变uniform_int_distribution的范围)
                  What is a seed in terms of generating a random number?(就生成随机数而言,种子是什么?)
                  Is 1.0 a valid output from std::generate_canonical?(1.0 是 std::generate_canonical 的有效输出吗?)
                  Getting big random numbers in C/C++(在 C/C++ 中获取大随机数)
                  What is the best way to generate random numbers in C++?(在 C++ 中生成随机数的最佳方法是什么?)
                  <i id='iD6aN'><tr id='iD6aN'><dt id='iD6aN'><q id='iD6aN'><span id='iD6aN'><b id='iD6aN'><form id='iD6aN'><ins id='iD6aN'></ins><ul id='iD6aN'></ul><sub id='iD6aN'></sub></form><legend id='iD6aN'></legend><bdo id='iD6aN'><pre id='iD6aN'><center id='iD6aN'></center></pre></bdo></b><th id='iD6aN'></th></span></q></dt></tr></i><div id='iD6aN'><tfoot id='iD6aN'></tfoot><dl id='iD6aN'><fieldset id='iD6aN'></fieldset></dl></div>
                    <bdo id='iD6aN'></bdo><ul id='iD6aN'></ul>

                      • <legend id='iD6aN'><style id='iD6aN'><dir id='iD6aN'><q id='iD6aN'></q></dir></style></legend>
                          <tfoot id='iD6aN'></tfoot>
                        • <small id='iD6aN'></small><noframes id='iD6aN'>

                              <tbody id='iD6aN'></tbody>