Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <427225A7.5050208@byu.net> Date: Fri, 29 Apr 2005 06:16:39 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: Dave Korn CC: "'Jeff Johnston'" , "'Jean-Christophe Kablitz'" , cygwin AT cygwin DOT com, newlib AT sources DOT redhat DOT com Subject: Re: [PATCH] Fix newly exposed bug [was RE: RFC: Fix partial NaN-parsing problem [was RE: sscanf problem]] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes -----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 ebb9 AT byu DOT net -----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/