Title
Sync intmax_t and uintmax_t with C2x
Status
c++23
Section
[cstdint.syn]
Submitter
GB

Created on 2022-11-10.00:00:00 last changed 12 months ago

Messages

Date: 2023-02-13.11:31:32

Proposed resolution:

This wording is relative to N4917.

  1. Modify [cinttypes.syn] as indicated:

    -1- The contents and meaning of the header <cinttypes> are the same as the C standard library header <inttypes.h>, with the following changes:

    1. (1.1) — The header <cinttypes> includes the header <cstdint> instead of <stdint.h>, and

    2. (1.?) — intmax_t and uintmax_t are not required to be able to represent all values of extended integer types wider than long long and unsigned long long respectively, and

    3. (1.2) — if and only if the type intmax_t designates an extended integer type, the following function signatures are added:

      intmax_t abs(intmax_t);
      imaxdiv_t div(intmax_t, intmax_t);
      

      which shall have the same semantics as the function signatures intmax_t imaxabs(intmax_t) and imaxdiv_t imaxdiv(intmax_t, intmax_t), respectively.

    See also: ISO C 7.8

Date: 2023-02-13.00:00:00

[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP. ]

Date: 2023-02-07.01:44:06

[ Issaquah 2023-02-06; LWG ]

Unanimous consent (13/0/0) to move to Immediate for C++23.

Date: 2023-02-07.01:44:06

[ 2022-11; LEWG electronic polling ]

Unanimous consensus in favor.

Date: 2022-11-11.18:12:06

[ Kona 2022-11-10; Waiting for LEWG electronic polling ]

Date: 2022-11-10.00:00:00

This is the resolution for NB comment GB-080 17.4.1 [cstdint.syn] Sync intmax_t and uintmax_t with C2x.

With the approval of WG14 N2888 the next C standard will resolve the long-standing issue that implementations cannot support 128-bit integer types properly without ABI breaks. C++ should adopt the same fix now, rather than waiting until a future C++ standard is rebased on C2x.

[cinttypes.syn] also mentions those types, but doesn't need a change. The proposed change allows intmax_t to be an extended integer type of the same width as long long, in which case we'd still want those abs overloads.

Recommended change: Add to [cinttypes.syn] p2 "except that intmax_t is not required to be able to represent all values of extended integer types wider than long long, and uintmax_t is not required to be able to represent all values of extended integer types wider than unsigned long long."

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2023-02-13 11:31:32adminsetmessages: + msg13389
2023-02-13 11:31:32adminsetstatus: immediate -> wp
2023-02-07 01:44:06adminsetmessages: + msg13279
2023-02-07 01:44:06adminsetmessages: + msg13278
2023-02-07 01:44:06adminsetstatus: lewg -> immediate
2022-11-11 18:12:06adminsetmessages: + msg13021
2022-11-11 18:12:06adminsetstatus: new -> lewg
2022-11-11 00:40:18adminsetmessages: + msg13017
2022-11-10 00:00:00admincreate