Issue 1004: Classification of scanf failures

Authors: Joseph Myers
Date: 2025-03-07
Submitted against: C23
Status: Open
Cross-references: 1012

C23 7.23.6.3 (The fscanf function) describes failures as follows:

Failures are described as input failures (due to the occurrence of an encoding error or the unavailability of input characters), or matching failures (due to inappropriate input).

Unsupported specific width length modifiers (for example, %w123d if there is no int123_t or int_least123_t type and w123 is not implementation-defined to be supported anyway) are defined as error conditions for both printf and scanf functions (rather than undefined behavior). But is such an error an input failure or a matching failure? Or is it some new kind of failure, requiring the quoted dichotomy to be updated?

The same issue also applies for fwscanf.

No specific change is proposed here to address this issue since appropriate wording would depend on direction from the committee on what kind of failure this should be.