ISSUE 584

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 584
Notify-List
Category errata
Synopsis 17.2.4.3 Should %5c be allowed with $fscanf?
State open
Class errata-discuss
Arrival-DateMay 25 2004
Originator sharp@cadence.com (Behavioral Task Force)
Release
Environment
Description
The LRM allows $fscanf formats to specify an "optional
numerical maximum field width" as part of a conversion
specification. It is not clear whether this is allowed
on a %c specification, e.g. %5c.

ANSI C allows such a specification in fscanf, and it means
to read 5 characters into the output. It is very similar
to %5s for reading a string, except that it won't treat
white space characters specially the way %s does.

The intent may have been to allow this in $fscanf also.
However, the description of the %c descriptor is that
it matches a single character, whose 8 bit ASCII value
is returned. This does not allow for matching multiple
characters when there is a width specification.

This could be considered an erratum in the description of
the %c descriptor, which should be modified to allow
multiple characters when there is a width specified. Or
perhaps this capability was not intended to be allowed.
In that case, the LRM should say what happens with a
width on %c (presumably it should be an error). And in
that case, I think there should be an enhancement request
to allow this capability from ANSI C fscanf.
Fix
Unknown
Unformatted

Hosted by Boyd Technology