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/