Submitter:Fred Tydeman
Submission Date: 2019-11-04
Document: WG14 N2446
Title:N2446: printf of NaN()
Reference Documents: N2301
N2320
N2380
Summary
There is no way for a user's application to know the maximum number of characters in the NaN(n-char-sequence) output by printf(); the standard imposes no upper limit.
Aside: This change does not address the issue of the user having no control over the style of the output of NaN versus NaN(n-char-sequence). I have not heard that users are asking for such a change to allow such control.
Technical Corrigendum:
Add to §7.21.1 <stdio.h>, paragraph 3 [macros],
_PRINTF_NAN_LEN_MAXwhich expands to an integer constant expression (suitable for use in #if preprocessing directives) that is the maximum number of characters output for any [-]NAN(n-char-sequence) [footnote]. If an implementation has no support for NaNs, it shall be 0. _PRINTF_NAN_LEN_MAX shall be less than 64
[footnote]If the implementation only uses the [-]NAN style, then _PRINTF_NAN_LEN_MAX would have the value 4.