cvs commit: src/lib/libc/stdio vfscanf.c
Bruce Evans
bde at zeta.org.au
Fri Jul 4 08:34:13 PDT 2003
On Thu, 3 Jul 2003, Peter Jeremy wrote:
> On Sat, Jun 28, 2003 at 02:04:19AM -0700, David Schultz wrote:
> >On Sat, Jun 28, 2003, David Schultz wrote:
> >> Revamp scanf's floating-point-parsing algorithm to support
> >> [+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants.
> ...
> It would seem cleaner to use a common underlying set of conversion
> functions, similar to strtoX() but taking taking a FILE* and a width
> instead of a char*. The strtoX() functions can hand-craft the FILE
> structure much as sscanf() does.
>
> Benefits:
> - Removal of functionally duplicated code (vfscanf.c:parsefloat()
> and CT_INT code in vfscanf())
> - Removal of arbitrary(?) 512 char numeric conversion limit
>
> Disadvantages:
> - Additional effort to develop/maintain new code
> - Some additional overhead in the strtoX() functions to build the FILE
> structure.
The scanf family of functions should never be used (*), and I wouldn't
like to see the strtoX family of functions pessimized to support unusable
functions.
(*) Since among other problems, error handling using scanf is impossible.
The behaviour of scanf is undefined if the result of a conversion canout
be represented.
Bruce
More information about the cvs-src
mailing list