Which version of the C Standard Library does the C++23 Standard incorporate?

1.4k views Asked by At

(My original question was going to be about "What happened to _BitInt?" but that was based on a misreading of some cppreference pages).

The Library Introduction section 16.2 of the C++23 Draft Standard says that the C Standard library is supported in C++. The only reference to a specific C standard, however, is in a footnote (#141) in 16.3. This is to the 2018 C Standard, which doesn't mention _BitInt. But I found a description of _BitInt in the draft C 23 Standard.

Does the C++23 Standard incorporate a specific version of the C Standard Library?

  • If so, which one?
  • If not, is there a mechanism to incorporate the libraries of future C Standards?
2

There are 2 answers

0
Brian61354270 On BEST ANSWER

Quoting N4950 2.2 (the final working draft of the C++23 standard):

  1. The library described in ISO/IEC 9899:2018, Clause 7, is hereinafter called the C standard library3.

3 With the qualifications noted in Clause 17 through Clause 33 and in C.7, the C standard library is a subset of the C++ standard library

where ISO/IEC 9899:2018 is the C17 standard.

Note while the C++23 standard names a specific C standard library version, it is still possible for an implementation to provide any additional features as language extensions. That could include support for later versions of the C standard library or support for C core language features (like _BitInt(N)). For example, both GCC and Clang provide C99 VLAs as a language extension when compiling C++ code, and Clang supports C23's _BitInt(N) as an extension when compiling C++ code or C code for earlier editions.

0
Caleth On

You've misread cppreference, which despite the name is also a reference for C. The page you link describes the C23 standard, so it makes sense for it to list things added in that standard. The wikipedia page you link is for C++23, but it doesn't mention _BitInt.