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

Created on 2022-11-10.00:00:00 last changed 3 weeks ago

Messages

Date: 2022-11-11.18:12:06

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: 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
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