Submitter: Douglas A. Gwyn (J11)
Submission Date: 1999-10-19
Reference Document: ISO/IEC WG14 N896
Date: 2000-11-02 13:46:31
Subject: Problem implementing INTN_C macros
The requirements of subclause 188.8.131.52 may be impossible to satisfy (for N = 8 or 16, typically) unless an implementation has special (non-standard) support for integer constants of types char and short:
The macro INTN_C(value ) shall expand to a signed integer constant with the specified value and type int_leastN_t.(Similarly for UINTN_C.) The paragraph preceding this overly restrictive specification reflects the actual intent:
... a type with at least the specified width.
Suggested Technical Correction
In subclause 184.108.40.206 paragraph 2, change the two occurrences of "and type" to "and [un]signed integer type at least as wide as".
7.18.4 Macros for integer constants
[#1] The following function-like macros220 expand to integer constant expressions suitable for initializing objects that have integer types corresponding to types defined in <stdint.h>. Each macro name corresponds to a similar type name in 220.127.116.11 or 18.104.22.168.Add:
[#2] The argument in any instance of these macros shall be a decimal, octal, or hexadecimal constant (as defined in 22.214.171.124) with a value that does not exceed the limits for the corresponding type.
[#3] Each invocation of one of these macros shall expand to an integer constant expression suitable for use in #if preprocessing directives. The type of the expression shall have the same type as would an expression that is an object of the corresponding type converted according to the integer promotions. The value of the expression shall be that of the argument.
Most of the following wording is taken almost exactly from <limits.h>
126.96.36.199 Macros for minimum-width integer constants
[#1] Each of the following macros expands to an integer constant having the value specified by its argument and a type with at least the specified width.221)
221 For each name described in 188.8.131.52 that the implementation provides, the corresponding macro in this subclause is required.
Change [#2] to:
[#2] The macro INTN_C(value ) shall expand to an integer constant expression corresponding to the type int_leastN_t. The macro UINTN_C(value ) shall expand to an integer constant expression corresponding to the type uint_leastN_t. For example, if uint_least64_t is a name for the type unsigned long long int, then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
184.108.40.206 Macros for greatest-width integer constants
[#1] The following macro expands to an integer constant expression having the value specified by its argument and the type intmax_t:INTMAX_C(value)The following macro expands to an integer constant expression having the value specified by its argument and the type uintmax_t:UINTMAX_C(value)
Previous Defect Report < - > Next Defect Report