问题描述
我知道 C 和 C++ 标准保留了语言实现的许多方面,只是因为如果存在具有其他特征的架构,那么为它编写符合标准的编译器将非常困难或不可能.
I know that the C and C++ standards leave many aspects of the language implementation-defined just because if there is an architecture with other characteristics, it would be very difficult or impossible to write a standard conforming compiler for it.
我知道 40 年前,任何计算机都有自己独特的规格.但是,我不知道今天使用的任何架构:
I know that 40 years ago any computer had its own unique specification. However, I don't know of any architectures used today where:
CHAR_BIT != 8
signed
不是二进制补码(我听说 Java 有这个问题).- 浮点不符合 IEEE 754(我的意思是不在 IEEE 754 二进制编码中").
CHAR_BIT != 8
signed
is not two's complement (I heard Java had problems with this one).- Floating point is not IEEE 754 compliant ( I meant "not in IEEE 754 binary encoding").
我问的原因是,我经常向人们解释说,C++ 不强制要求任何其他低级方面(如固定大小的类型)是件好事†.这很好,因为与其他语言"不同,它使您的代码在正确使用时可移植(因为它可以移植到更多架构而无需模拟机器的低级方面,例如符号+幅度架构上的二进制补码算法).但我很难过自己无法指出任何具体的架构.
The reason I'm asking is that I often explain to people that it's good that C++ doesn't mandate any other low-level aspects like fixed sized types†. It's good because unlike 'other languages' it makes your code portable when used correctly ( because it can be ported to more architectures without requiring emulation of low-level aspects of the machine, like e.g. two's complement arithmetic on sign+magnitude architecture). But I feel bad that I cannot point to any specific architecture myself.
所以问题是:哪些架构具有上述特性?
So the question is: what architectures exhibit the above properties?
† uint*_t
s 是可选的.
推荐答案
看看这个
Unisys ClearPath Dorado 服务器
为尚未迁移所有 Univac 软件的用户提供向后兼容性.
offering backward compatibility for people who have not yet migrated all their Univac software.
关键点:
- 36 位字
CHAR_BIT == 9
- 补码
- 72 位非 IEEE 浮点数
- 代码和数据的独立地址空间
- 字地址
- 没有专用的堆栈指针
虽然不知道他们是否提供 C++ 编译器,但他们可以.
Don't know if they offer a C++ compiler though, but they could.
现在他们的 C 手册最新版本的链接已经浮出水面:
And now a link to a recent edition of their C manual has surfaced:
Unisys C 编译器编程参考手册一个>
第 4.5 节有一个包含 9、18、36 和 72 位的数据类型表.
Section 4.5 has a table of data types with 9, 18, 36, and 72 bits.
这篇关于标准委员会关心的异乎寻常的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!