c++ - 来自 C++11 中 C99 的 fenv.h

标签 c++ c c++11

C++11 中是否存在 C99 中的 fenv.h?还有其他方法可以使用fesetround之类的功能吗?也许提升?

gcc 4.7.2 编译这段代码:

#include <cfenv>

int main() {}

http://liveworkspace.org/code/ffbd8e8a24633c7e74f7bcead3b1a287

最佳答案

Does fenv.h from C99 exists in C++11?

是的。

引用:

26.3 The floating-point environment [cfenv]
Standard C++11 26.3.1 Header <cfenv> synopsis [cfenv.syn]

Is there any other ways to use function like fesetround()? Maybe boost?

fesetround() 函数已经由 C++11 中的 cfenv 提供。
此外,fenv.h 也存在于 C++11 中,以便向后兼容 c 标准头文件。它涵盖在:

D.5 C standard library headers [depr.c.headers]

What is the difference between using fenv.h or cfenv?

包含 cfenv 会在 std 命名空间和可能 全局命名空间中导入符号名称。 包含 fenv.h 会在全局命名空间中导入符号名称,并且可能会在 std 命名空间中导入符号名称。

关于c++ - 来自 C++11 中 C99 的 fenv.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12667409/

相关文章:

c++ - 关于类互动的问题

c - 无法在C程序中输入带空格的名称?

c++ - 插入流的右值引用是否合理有效?

c - 如何修复函数,search_replace 负数为 '0'

c++在据称不应该有好处的地方 move 语义

c++ - 使用 SFINAE 时如何避免触发 static_assert?

C++ 编译器说 "inconsistent deduction for auto return type"

c++ - 检查 STL 排序 vector 中 upper_bound 的返回值

c++ - 您如何使用标准引号解释指向基类和派生类成员的指针的这种差异?

c - 从文件行扫描直到 C 中的整数