简体   繁体   English

C ++库的C部分是自动C99吗?

[英]Is the C part of the C++ library automatically C99?

Are all the functions in a conformant C++98/03/0x implementation completely C99 conformant? 符合C ++ 98/03 / 0x实现的所有函数是否完全符合C99?

I thought C++0x added some C99 ( language ) features, but never heard or read anything definitive about the C library functions. 我认为C ++ 0x添加了一些C99( 语言 )功能,但从未听过或读过任何关于C库函数的确定性。

Just to avoid any confusion, I'm talking about a C++ program using functions declared in the <c*> header set. 为了避免任何混淆,我在谈论使用<c*>标头集中声明的函数的C ++程序。

Thanks. 谢谢。

Most of the C99 standard library has been imported in C++0X but not all. 大多数C99标准库都是用C ++ 0X导入的,但不是全部。 From memory, in what wasn't imported there are 从记忆中,在那里没有进口的东西

  • <ctgmath> simply includes <ccomplex> and <cmath> , <ctgmath>只包含<ccomplex><cmath>
  • <ccomplex> behaves as if it included <complex> <ccomplex>表现得好像包含<complex>
  • <cmath> has quite a few adjustment (providing overload and template functions completing the C99 provided one) <cmath>有相当多的调整(提供过载和模板功能完成C99提供的一个)
  • Some other headers ( <cstdbool> , <iso646.h> , ...) have adjustments to take differences between language into account ( bool is primitive in C++, a macro provided by <stdbool.h> in C for instance), but nothing of the scope of the math part. 其他一些标题( <cstdbool><iso646.h> ,...)进行了调整以考虑语言之间的差异( bool在C ++中是原始的,例如在C中由<stdbool.h>提供的宏),但是没有数学部分的范围。

The headers <xxx.h> whose <cxx> form doesn't behaves as the C99 version simply declares the content of <cxxx> in the global namespace, they aren't nearer of the C99 <xxx.h> content. <xxx.h><cxx>形式不像C99版本那样只是在全局命名空间中声明了<cxxx>的内容,它们并不接近C99 <xxx.h>内容。

A related thing: C++0X provides some headers in both cxxx and xxx.h forms which aren't defined in C99 ( <cstdalign> and <cuchar> , the second one is defined in a C TR) 相关的事情:C ++ 0X提供cxxx和xxx.h形式的一些头文件,这些头文件未在C99中定义( <cstdalign><cuchar> ,第二个在C TR中定义)

(I remembered that a bunch of mathematical functions from C99 had been put in TR1 but not kept in C++0X, I was mistaken, that bunch of mathematical functions weren't part of C99 in the first place). (我记得C99中的一堆数学函数已放在TR1中,但没有保存在C ++ 0X中,我错了,一堆数学函数首先不是C99的一部分)。

No. C++03 is aligned with ANSI C89/ISO C90, not C99. No. C ++ 03与ANSI C89 / ISO C90对齐,而不是C99。

The upcoming C++0x standard is expected to be aligned to some degree with C99. 即将推出的C ++ 0x标准在某种程度上与C99保持一致。 See paragraph 17.6.1.2 in the current draft which lists ccomplex , cinttypes , cstdint etc. Note that, as AProgrammer mentions, some headers aren't exactly the same; 参见当前草案中的第17.6.1.2段,其中列出了ccomplexcinttypescstdint等。请注意,正如AProgrammer所提到的,一些标题并不完全相同; further, that the header cuchar is aligned with the C Technical Report 19769 rather than C99. 此外,标题cucharC技术报告19769而不是C99对齐。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM