From 01d34e934a395675ba3c576f2a51f10b86efbc20 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 30 Sep 2021 20:53:34 +0000 Subject: Add C2X _PRINTF_NAN_LEN_MAX C2X adds a macro _PRINTF_NAN_LEN_MAX to , giving the maximum length of printf output for a NaN. glibc never includes an n-char-sequence in its printf output for NaNs, so the correct value for glibc is 4 ("-nan" or "-NAN"); define the macro accordingly. This patch makes the macro definition conditional on __GLIBC_USE (ISOC2X), as is generally done with features from new standard versions. The name is in the implementation namespace for older standards, so it would also be possible to define it unconditionally. Tested for x86_64. --- libio/stdio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libio') diff --git a/libio/stdio.h b/libio/stdio.h index 497da01..0a5c76b 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -133,6 +133,12 @@ typedef __fpos64_t fpos64_t; #include +#if __GLIBC_USE (ISOC2X) +/* Maximum length of printf output for a NaN. */ +# define _PRINTF_NAN_LEN_MAX 4 +#endif + + /* Standard streams. */ extern FILE *stdin; /* Standard input stream. */ extern FILE *stdout; /* Standard output stream. */ -- cgit v1.1