-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Dave Korn on 4/28/2005 12:41 PM: > Heh, actually we probably have to talk about that. The k should IIUIC be > swallowed by the %lf and the %c should fail; this is the production > described as NAN(n-char-sequence opt) in the C language spec, strtod > documentation (that's 7.20.1.3.3 in WG14/N843 draft, I don't have the final > version). And we haven't even mentioned the lack of INF support yet :)
Per POSIX, http://www.opengroup.org/onlinepubs/009695399/functions/sscanf.html, NAN{n-char-sequence} is implementation defined - sscanf should only accept n-char-sequences that are also generated by the same implementation's printf and parsed by strtod. And since newlib printf does not output any n-char-sequence versions of NaN, sscanf should not parse them. IIUC, n-char-sequence exists to allow implementations the ability to specify signalling NaNs or exact bit patterns within the NaN. All this means that I think Jeff is right that i = sscanf ("nank", "%lf%c%n", &x, &m, &n) should succeed on newlib, but you should also remember that it is not portable and that on non-newlib systems it might fail. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCciWn84KuGfSFAYARAn57AKC4NQ8N9eIfdVRw4wTqzSzkyJIbPgCffhII wOxYCH3ae9wn47EgS0sTYGs= =L/cl -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/