简体   繁体   English

在 C++11 标准中的什么地方规定了 std::fmodf?

[英]Where in the C++11 standard is std::fmodf stated?

According to the cppref page , std::fmodf was added to cmath in C++11.根据cppref 页面,在 C++11 中将 std::fmodf 添加到 cmath。 How is this possible though, because wouldn't this mean that cmath would break compatability with math.h previous to C++11?这怎么可能,因为这不意味着 cmath 会破坏与之前 C++11 之前的 math.h 的兼容性吗? I'm unable to find any references that say std::fmodf was added in C++11 and was wondering where this is stated.我找不到任何说 std::fmodf 被添加到 C++11 的引用,我想知道这是在哪里说明的。

Thank you谢谢

Where in the C++11 standard is std::fmodf stated?在 C++11 标准中的什么地方规定了 std::fmodf?

It wasn't mentioned directly (although it probably should have been mentioned either in the list of functions, or explicitly omitted).它没有直接提及(尽管它可能应该在函数列表中提及,或者明确省略)。 The change that causes std::fmodf to exist is here (quote from draft N3337):导致std::fmodf存在的变化在这里(引自草案 N3337):

The following referenced documents are indispensable for the application of this document.以下参考文件对于本文件的应用是必不可少的。 For dated references, only the edition cited applies.对于注明日期的参考文献,仅引用的版本适用。 For undated references, the latest edition of the referenced document (including any amendments) applies.对于未注明日期的引用文件,引用文件的最新版本(包括任何修改)适用。

  • ... ...
  • ISO/IEC 9899: 1999 , Programming languages — C ISO/IEC 9899: 1999 ,编程语言 — C
  • ... ...

Through the following rule:通过以下规则:

[c.math] [c.数学]

The contents of these headers are the same as the Standard C library headers <math.h> and <stdlib.h> respectively, with the following changes: ...这些头文件的内容分别与标准 C 库头文件 <math.h> 和 <stdlib.h> 相同,具有以下更改: ...

C99 added fmodf. C99 添加了 fmodf。 It was inherited to C++ when C++11 started referring to the standard library of C99 instead of C89.当 C++11 开始引用 C99 的标准库而不是 C89 时,它被继承到 C++。

Note, the "following changes" do not list omission of fmodf .请注意,“以下更改”并未列出fmodf的遗漏。


Why isn't fmodf listed in the list of functions (26.8/3 and 26.8/9)?为什么 fmodf 没有在函数列表(26.8/3 和 26.8/9)中列出? It was added to the list in the C++17 standard.它被添加到 C++17 标准的列表中。

This appears to have been an editorial mistake.这似乎是一个编辑错误。 It seems to have been fixed in C++17 by P0175 which proposes:它似乎已由P0175在 C++17 中修复,它建议:

In this editorial paper we propose to add to the working draft the complete synopses of the C library headers that are included in C++ by reference to the C standard (see Table 15).在这篇社论论文中,我们建议通过参考 C 标准,将 C 库头文件的完整概要添加到工作草案中,这些头文件包含在 C++ 中(见表 143E1257Z 标准) These synopses will replace the various tables captioned “Header synopsis”.这些概要将取代标题为“标题概要”的各种表格。


Sidenote: std::fmodf is fairly useless in C++, since you can simply use std::fmod instead, and that has been around since C++98.旁注: std::fmodf在 C++ 中相当无用,因为您可以简单地使用std::fmod来代替,而且自 C++98 以来一直存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么c ++ 11标准库中没有std :: clear - Why is there no std::clear in c++11 standard library C++ std=c++11 和 std=gnu++11 之间的标准正则表达式区别 - C++ standard regex difference between std=c++11 and std=gnu++11 C ++ 11 std :: array - C++11 std::array 使用-std = c ++ 11的Makefile - Makefile with -std=c++11 标准C ++ 11是否保证std :: async(std :: launch :: async,func)在单独的线程中启动func? - Does standard C++11 guarantee that std::async(std::launch::async, func) launches func in separate thread? 哪个“标准”是C ++ 11标准? - Which “standard” is the C++11 standard? 是否在C ++ 11标准中指定std :: begin(Container &amp;&amp;)返回const_iterator? - Is it specified in the C++11 standard that std::begin(Container&&) returns const_iterator? 使用C ++ 11期货:std :: async崩溃的嵌套调用:编译器/标准库错误? - Using C++11 futures: Nested calls of std::async crash: Compiler/Standard library bug? 为什么std :: pair类标准被改为禁止在C ++ 11中只有非常量复制构造函数的类型? - Why was the std::pair class standard changed to disallow types with only a nonconstant copy constructor in C++11? 使用标准库在 c++11 中使用 std::tie 提取嵌套在元组中的元组 - Extracting tuple nested in a tuple using std::tie in c++11 using standard library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM