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

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


7

(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?

11

  • 1

    I am not sure if I understand what you are asking. Your link to cppreference deals with C23, and the Wikipedia articles deals with **C++**23, and I cannot find any reference to _BitInt in that page. Am I missing something?

    – Erel

    10 hours ago


  • 1

    Should that be "claim that C23 adds", not C++23?

    – Brian61354270

    9 hours ago

  • 5

    This is from the draft C++ Standard [defns.c.lib] "…library described in ISO/IEC 9899:2018, Clause 7…" – you would now need to reference the ISO number to the C Standard.

    – Richard Critten

    9 hours ago


  • 2

    @RichardCritten I think that qualifies as an answer

    – Brian61354270

    9 hours ago

  • 1

    @RichardCritten It's C17: open-std.org/jtc1/sc22/wg14/www/projects.html 🙂

    – Yksisarvinen

    9 hours ago

2 Answers
2


6

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, it is still possible for implementations to support features from later C editions as language extensions. For example, Clang supports C23’s _BitInt(N) as an extension when compiling C++ code.

1

  • I will come back tomorrow and mark this as the answer.

    – Spencer

    9 hours ago


1

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.



Leave a Reply

Your email address will not be published. Required fields are marked *