c++ - Incorrect definitions in <stdint.h> for 64-bit unsigned constants
- Keith Thompson (31/31) Oct 22 2025 The link to the bugzilla appears to be broken, so I'm reporting this
The link to the bugzilla appears to be broken, so I'm reporting this here. I've installed dm857c.zip on Windows 11. The following program : #include <stdio.h> #include <stdint.h> int main(void) { printf("UINT64_MAX = %ju = 0x%jx\n", UINT64_MAX, UINT64_MAX); printf("UINT_LEAST64_MAX = %ju = 0x%jx\n", UINT_LEAST64_MAX, UINT_LEAST64_MAX); printf("UINT_FAST64_MAX = %ju = 0x%jx\n", UINT_FAST64_MAX, UINT_FAST64_MAX); printf("UINTMAX_MAX = %ju = 0x%jx\n", UINTMAX_MAX, UINTMAX_MAX); } is rejected with the error "Lexical error: number is not representable" on lines 4, 5, 6, and 7. The correct output should be : UINT64_MAX = 18446744073709551615 = 0xffffffffffffffff UINT_LEAST64_MAX = 18446744073709551615 = 0xffffffffffffffff UINT_FAST64_MAX = 18446744073709551615 = 0xffffffffffffffff UINTMAX_MAX = 18446744073709551615 = 0xffffffffffffffff The problem is in the definitions of the 64-bit *_MAX macros in C:\dm\include\stdint.h : #define UINT64_MAX 18446744073709551615 #define UINT_LEAST64_MAX 18446744073709551615 #define UINT_FAST64_MAX 18446744073709551615 #define UINTMAX_MAX 18446744073709551615 Unsuffixed decimal integer constants are always of some signed type. These constants exceed ULLONG_MAX, which results in the errors when they're expanded. Experiment shows that adding a "ULL" suffix to each of these constants corrects the problem. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u gmail.com void Void(void) { Void(); } /* The recursive call of the void */
Oct 22 2025







Keith Thompson <Keith.S.Thompson+u gmail.com>