Document Number: WG14 N668/X3J11 97-031 C9X Revision Proposal ===================== Title: Format modifier for intmax_t and uintmax_t values. Author: Clive D.W. Feather Author Affiliation: Demon Internet Ltd. Postal Address: 322 Regent Park Road, London N3 2QQ, UK E-mail Address: clive@demon.net Telephone Number: +44 181 371 1138 Fax Number: +44 181 371 1150 Sponsor: none so far Date: 1997-02-08 Proposal Category: __ Editorial change/non-normative contribution __ Correction XX New feature __ Addition to obsolescent feature list __ Addition to Future Directions __ Other (please specify) ______________________________ Area of Standard Affected: __ Environment __ Language __ Preprocessor XX Library __ Macro/typedef/tag name XX Function __ Header __ Other (please specify) ______________________________ Prior Art: none, but should be obvious Target Audience: careful programmers Related Documents (if any): none Proposal Attached: Yes Abstract: Add the modifier "m" to integral conversion specifiers in the *printf and *scanf functions (e.g. "%md" or "%15.3mX"), indicating that the corresponding argument has type intmax_t or uintmax_t. Rationale: There are a number of constructs, notably those using size_t and ptrdiff_t, where the actual type of an integral expression is unknown. To print such values, it is necessary to cast them to a large type - [un]signed long was traditionally used, but C9X now has [u]intmax_t. The problem with the latter is that there is no way to conveniently print *it* other than with no field width or precision or format flags. Given the significance of the "largest type", it should be more convenient to print it in various ways. Detailed changes: [relative to C9X Draft 8] 7.11.6.1 (fprintf) paragraph 3 and 7.17.2.1 (fwprintf) paragraph 4, in each case the fourth bullet point, insert the following clauses: an optional m specifying that a following d, i, o, u, x, or X conversion specifier appiles to a intmax_t or uintmax_t argument; an optional m specifying that a following n conversion specifier applies to a pointer to a intmax_t argument; and insert m into the last sentence. 7.11.6.2 (fscanf) and 7.17.2.2 (fwscanf), both at paragraph 3, third bullet point, change to: An optional h, l (ell), ll (ell-ell), m, or L indicating ... pointer to long, by ll if it is a pointer to long long int, or by m if it is a pointer to intmax_t. ... pointer to unsigned long int, by ll if it is a pointer to unsigned long long int, or by m if it is a pointer to uintmax_t. and insert m into the last sentence. ==== ENDS ====