1. <tfoot id='CC7GJ'></tfoot>

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

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

        是否允许 C++ 编译器发出不同的机器代码来编译相同的程序?

        Is a C++ compiler allowed to emit different machine code compiling the same program?(是否允许 C++ 编译器发出不同的机器代码来编译相同的程序?)

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

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

              • <tfoot id='qG2Pu'></tfoot>
                  <tbody id='qG2Pu'></tbody>

                1. 本文介绍了是否允许 C++ 编译器发出不同的机器代码来编译相同的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  考虑一种情况.我们有一些特定的 C++ 编译器、一组特定的编译器设置和一个特定的 C++ 程序.

                  Consider a situation. We have some specific C++ compiler, a specific set of compiler settings and a specific C++ program.

                  我们使用该编译器和这些设置编译该特定程序两次,每次都进行干净编译".

                  We compile that specific programs with that compiler and those settings two times, doing a "clean compile" each time.

                  发出的机器代码应该是相同的(我不是说时间戳和其他花里胡哨,我的意思是只有将被执行的真实代码)还是允许从一个编译到另一个编译而有所不同?

                  Should the machine code emitted be the same (I don't mean timestamps and other bells and whistles, I mean only real code that will be executed) or is it allowed to vary from one compilation to another?

                  推荐答案

                  C++ 标准当然没有规定要防止这种情况发生.然而,实际上,编译器通常是确定性的,因此给定相同的输入,它将产生相同的输出.

                  The C++ standard certainly doesn't say anything to prevent this from happening. In reality, however, a compiler is normally deterministic, so given identical inputs it will produce identical output.

                  真正的问题主要是它将环境的哪些部分视为其输入——有一些似乎假设构建机器的特性反映了目标的特性,并改变了它们的输出基于构建环境中隐含的输入"而不是明确声明,例如通过编译器标志.也就是说,即使这样也相对不寻常.规范是输出依赖于显式输入(输入文件、命令行标志等)

                  The real question is mostly what parts of the environment it considers as its inputs -- there are a few that seem to assume characteristics of the build machine reflect characteristics of the target, and vary their output based on "inputs" that are implicit in the build environment instead of explicitly stated, such as via compiler flags. That said, even that is relatively unusual. The norm is for the output to depend on explicit inputs (input files, command line flags, etc.)

                  随便,我只能想到一件相当明显的自发"变化的事情:一些编译器和/或链接器将时间戳嵌入到它们的输出文件中,因此输出文件的几个字节将从一个构建更改为下一个构建--但这只会在嵌入文件的元数据中,而不是对生成的实际代码的更改.

                  Offhand, I can only think of one fairly obvious thing that changes "spontaneously": some compilers and/or linkers embed a timestamp into their output file, so a few bytes of the output file will change from one build to the next--but this will only be in the metadata embedded in the file, not a change to the actual code that's generated.

                  这篇关于是否允许 C++ 编译器发出不同的机器代码来编译相同的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Is Type(::x); valid?(是类型(::x);有效的?)
                  Difference between an inline function and static inline function(内联函数和静态内联函数的区别)
                  Compilation fails randomly: quot;cannot open program databasequot;(编译随机失败:“无法打开程序数据库)
                  Too many initializers error for a simple array in bcc32(bcc32 中的简单数组的初始值设定项过多错误)
                  No Member named stoi in namespace std(命名空间 std 中没有名为 stoi 的成员)
                  Error using a constexpr as a template parameter within the same class(在同一个类中使用 constexpr 作为模板参数时出错)

                    • <tfoot id='XLzrR'></tfoot>
                        <tbody id='XLzrR'></tbody>

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

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