scanf(3) patch for C99-conformant FP parsing

David Schultz das at freebsd.org
Tue Jun 24 06:25:55 PDT 2003


On Tue, Jun 24, 2003, Andrey Chernov wrote:
> On Tue, Jun 24, 2003 at 04:44:18 -0700, David Schultz wrote:
> > Outstanding issues:
> > 	- I'm not sure that it's okay to use isdigit(3) and
> > 	  friends in sprintf().  The standard seems to imply that
> > 	  it would be okay if every digit in the C locale were
> > 	  also a digit in all other locales.
> 
> isdigit() always for 0..9 only, isxdigit() is a like, don't know, what 
> you mean by 'friends'.
>
> > +				} else if (!isalnum(c) && c != '_')
> 
> F.e. isalnum() you should use with care, it may hit national characters.

That's what I was worried about.  I believe that's okay by the
standard as long as isalnum() still accepts *at least*
[a-z][A-Z][0-9] in any locale.  Is this a valid assumption or do I
need to test by hand?

> BTW, in all cases calling is*() macros on char may have side effects, you 
> need to promote argument to (unsigned char) first.

Okay, I'll do that.  Thanks.


More information about the freebsd-standards mailing list