Is the C part of the C++ library automatically C99?
Are all the functions in a conf开发者_如何学JAVAormant C++98/03/0x implementation completely C99 conformant?
I thought C++0x added some C99 (language) features, but never heard or read anything definitive about the C library functions.
Just to avoid any confusion, I'm talking about a C++ program using functions declared in the <c*>
header set.
Thanks.
Most of the C99 standard library has been imported in C++0X but not all. From memory, in what wasn't imported there are
<ctgmath>
simply includes<ccomplex>
and<cmath>
,<ccomplex>
behaves as if it included<complex>
<cmath>
has quite a few adjustment (providing overload and template functions completing the C99 provided one)- 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.
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.
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)
(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).
No. C++03 is aligned with ANSI C89/ISO C90, not C99.
The upcoming C++0x standard is expected to be aligned to some degree with 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; further, that the header cuchar
is aligned with the C Technical Report 19769 rather than C99.
精彩评论