Clarify the specification of the width macros

Jens Gustedt, INRIA and ICube, France

2024-12-01

target

integration into IS ISO/IEC 9899:202y

document history

document number date comment
n3413 202412 Original proposal

license

CC BY, see https://creativecommons.org/licenses/by/4.0

1 Motivation

The current wording in 5.3.5.3.2 has lead to misunderstandings, in particular it had not been clear to implementations that the provided values are further constrained later by specific properties of certain integer types, in particular for bool. We propose to clarify this by making it explicit how the properties (width) and the macros (_WIDTH) relate.

2 Suggested changes to the wording.

New text is underlined green, removed text is stroke-out red.

5.3.5.3.2 Characteristics of integer types <limits.h> and <stdint.h>

1 Each integer type (6.2.5) that is defined by this document and that is not a bit-precise integer type has a corresponding width macro with a name ending in _WIDTH. The values of these macros provide the number of bits in the value representation of the type (6.2.6.2). The values given subsequently shall be replaced by constant expressions suitable for use in conditional expression inclusion preprocessing directives. Their implementation-defined values Those of the values that are implementation-defined shall be equal or greater to those shown; otherwise the values shall be exact.

Aknowledgements

Thanks to Aaron Ballman for discussion and feedback.