delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/29/08:24:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: Dave Korn <dave DOT korn AT artimi DOT com>
CC: "'Jeff Johnston'" <jjohnstn AT redhat DOT com>,
"'Jean-Christophe Kablitz'" <jckablitz AT infonie DOT fr>, 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: <SERRANOwr2UAaTzvb5Y0000017b AT SERRANO DOT CAM DOT ARTIMI DOT COM>
In-Reply-To: <SERRANOwr2UAaTzvb5Y0000017b@SERRANO.CAM.ARTIMI.COM>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019