INT
N_C
macrosThis issue has been automatically converted from the original issue lists and some formatting may not have been preserved.
Authors: Douglas A. Gwyn (J11)
Date: 1999-10-19
Reference document: ISO/IEC WG14 N896
Submitted against: C99
Status: Fixed
Fixed in: C99 TC1
Converted from: summary-c99.htm, dr_209.htm
The requirements of subclause 7.18.4.1 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
INT
N_C(
value)
shall expand to a signed integer constant with the specified value and typeint_least
N_t
.
(Similarly for UINT
N_C
.) The paragraph preceding this overly restrictive
specification reflects the actual intent:
... a type with at least the specified width.
Possible Solutions
int_least
N_t
.Suggested Technical Correction
In subclause 7.18.4.1 paragraph 2, change the two occurrences of "and type" to
"and [un]signed integer type at least as wide as".
Comment from WG14 on 2000-11-02:
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 7.18.1.2 or 7.18.1.5.[#2] The argument in any instance of these macros shall be a decimal, octal, or hexadecimal constant (as defined in 6.4.4.1) with a value that does not exceed the limits for the corresponding type.
Add:
[#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>
7.18.4.1 Macros for minimum-width integer constants
Remove:
[#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 7.18.1.2 that the implementation provides, the corresponding macro in this subclause is required.
Change [#2] to:
[#2] The macro
INT
N_C(
value)
shall expand to an integer constant expression corresponding to the typeint_least
N_t
. The macroUINT
N_C(
value)
shall expand to an integer constant expression corresponding to the typeuint_least
N_t
. For example, ifuint_least64_t
is a name for the typeunsigned long long int
, thenUINT64_C(0x123)
might expand to the integer constant0x123ULL
.
7.18.4.2 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)