我经常在 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 条下:
- 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/