c - 以双下划线开头的类型是否表示模拟类型?

标签 c x86 floating-point

long double 类型用于 80 位 float ,x87 extantion 有使用此数据类型的说明。

我知道有 __float128 并且这种类型的基本操作由编译器模拟。但是没有必要模拟 80 位浮点运算。那么 __float80 的目的是什么?

我猜有些架构没有 80 位 float 据类型,所以 __float80 就像跨平台类型。如果 CPU 能够使用 80 位 fp,则 long double__float80 相同。如果不是,则 long double 不存在或引用其他内容,编译器模拟 80 位 fp 操作,因此只有 __float80 可用于表示 80 位 float 。

我说的对吗?你能给我举一些例子吗?

最佳答案

双下划线表示该标识符保留供 C 实现使用。

C11 标准 7.1.3: Reserved Identifiers

  • All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.
  • All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces.

基本上,它是一个保留 namespace ,以避免与为一般用途创建的标识符发生冲突。该实现可以确保它不会破坏自己的标识符,并且只要您的程序不使用以双下划线(或下划线后跟大写字母)开头的保留标识符空间,就不会发生冲突。

关于c - 以双下划线开头的类型是否表示模拟类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58017932/

相关文章:

c# - 在返回 float 的方法中将结果转换为 float 会改变结果

c++ - "Moving"数字朝向另一个数字而不超过它 - 任何无分支版本?

assembly - x86 Intel 汇编器 LEA

c++ - 现代x86硬件能否不将单个字节存储到内存中?

c - Getopt 不包括在内?函数 ‘getopt’ 的隐式声明

c - 查找数组中具有给定差异的元素

assembly - 从通用寄存器加载/存储到 xmm/ymm 寄存器/从 xmm/ymm 寄存器加载/存储的最佳方式

c - 在 C 中打印带逗号的 float

c - jemalloc、mmap 和共享内存?

C 程序 - 在用户输入时需要检查字符串的一部分