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

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

      <legend id='sd31N'><style id='sd31N'><dir id='sd31N'><q id='sd31N'></q></dir></style></legend>
        <bdo id='sd31N'></bdo><ul id='sd31N'></ul>
      <tfoot id='sd31N'></tfoot>
      1. GCC 内联 C++ 函数是否没有“inline"关键字?

        时间:2023-09-16

          <tbody id='eb5lg'></tbody>
      2. <tfoot id='eb5lg'></tfoot>

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

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

                2. 本文介绍了GCC 内联 C++ 函数是否没有“inline"关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在编译 C++ 代码时,GCC 是否曾尝试通过选择内联未用 inline 关键字标记的函数来优化速度?

                  Does GCC, when compiling C++ code, ever try to optimize for speed by choosing to inline functions that are not marked with the inline keyword?

                  推荐答案

                  是的.任何编译器只要认为它是一个好主意,都可以自由地内联任何函数.GCC 也这样做.

                  Yes. Any compiler is free to inline any function whenever it thinks it is a good idea. GCC does that as well.

                  -O2 优化级别,内联在编译器认为值得做(使用启发式)并且如果它不会增加代码.在 -O3 处,只要编译器认为值得做,就会执行,而不管它是否会增加代码的大小.此外,在所有优化级别(即启用的优化)中,内联只调用一次的静态函数.

                  At -O2 optimization level the inlining is done when the compiler thinks it is worth doing (a heuristic is used) and if it will not increase the size of the code. At -O3 it is done whenever the compiler thinks it is worth doing, regardless of whether it will increase the size of the code. Additionally, at all levels of optimization (enabled optimization that is), static functions that are called only once are inlined.

                  正如下面的评论中所指出的,这些 -Ox 实际上是包含多个更具体设置的复合设置,包括与内联相关的设置(如 -finline-functions 和这样),所以我们也可以根据那些更具体的设置来描述行为(并控制它).

                  As noted in the comments below, these -Ox are actually compound settings that envelop multiple more specific settings, including inlining-related ones (like -finline-functions and such), so one can also describe the behavior (and control it) in terms of those more specific settings.

                  这篇关于GCC 内联 C++ 函数是否没有“inline"关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:哪个更快/首选:memset 或 for 循环将双精度数组归零 下一篇:在 g++ 上进行聚合初始化的 std::array 生成大量代码

                  相关文章

                  最新文章

                    <bdo id='4JpwY'></bdo><ul id='4JpwY'></ul>

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

                    <small id='4JpwY'></small><noframes id='4JpwY'>

                    <legend id='4JpwY'><style id='4JpwY'><dir id='4JpwY'><q id='4JpwY'></q></dir></style></legend>