c++ - 当声明 "Implementation"时,什么样的软件是 "Implementation-defined"的一部分? "Implementation"到底是什么?

标签 c++ c implementation

我经常在 C 标准文档中看到“实现定义”的说法,并且非常将其作为答案。

然后我在 C99 标准中搜索它,并且:

ISO/IEC 9899/1999 (C99) 中第 §3.12 条规定:

3.12

Implementation

particular set of software, running in a particular translation environment under particular control options, that performs translation of programs for, and supports execution of functions in, a particular execution environment

以及第 §5 条下:

  1. Environment

An implementation translates C source files and executes C programs in two dataprocessing-system environments, which will be called the translation environment and the execution environment in this International Standard. Their characteristics define and constrain the results of executing conforming C programs constructed according to the syntactic and semantic rules for conforming implementations.

但是它到底指的是哪些软件应用程序?

具体是哪一套软件?

它被描述为提供翻译和执行环境。所以这不可能只是编译器的问题,还是我的这个假设是错误的?

我可以将系统的哪些部分视为“实现”的一部分?

是所使用的编译器与其依赖的C标准、操作系统、所使用的C标准本身的组合还是它们的混合?

尽管有前面的陈述,它是否还包括硬件(使用的处理器、主板等)?

我完全不明白,什么是实现 exaclty。

我觉得我必须是一个拥有 100 年经验的机器人才能完全准确地知道这一切都包括什么。

最佳答案

一般来说,“实现”是指给定的编译器及其运行的机器。后者很重要,因为字节顺序等因素决定了整数和浮点类型的字节顺序以及其他考虑因素。

需要一个实现来记录其实现定义的行为。例如,您可以找到 GCC's implementation defined behavior here .

编译器通常支持多个版本的 C 标准,因此每种操作模式也可以被视为一种实现。例如,您可以将-std选项传递给GCC来指定c89、c99。或 c11 模式。

关于c++ - 当声明 "Implementation"时,什么样的软件是 "Implementation-defined"的一部分? "Implementation"到底是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58560581/

相关文章:

algorithm - 用两个堆栈实现队列有什么好处?

c++ - 如何使用英特尔PIN捕获到阵列的所有负载?

c++ - cout txt文件的getline命令

c++ - 显式特化中函数名称后的空尖括号

c++ - C 和 C++ : Freeing PART of an allocated pointer

encoding - 试图理解 PNG 文件中的 zlib/deflate

c++ - 如何防止使用 CMake 对 Protobuf 生成的文件进行不必要的重新编译?

C 测试 - Unity 和 CMake 的 undefined reference

c - PIC 16F628 CC5X结构

android - 如何在 Eclipse 中将开源文件添加到我的应用程序?