Date: Fri, 08 Aug 2003 17:56:06 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp-workers AT delorie DOT com Message-Id: <2427-Fri08Aug2003175605+0300-eliz@elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <200308080854.KAA17657@lws256.lu.erisoft.se> (message from Martin Stromberg on Fri, 8 Aug 2003 10:54:41 +0200 (MET DST)) Subject: Re: (fwd) Re: sscanf's return value References: <200308080854 DOT KAA17657 AT lws256 DOT lu DOT erisoft DOT se> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Martin Stromberg > Date: Fri, 8 Aug 2003 10:54:41 +0200 (MET DST) > > Because the standard says > " The sscanf function returns the value of the macro EOF if an > input failure occurs before any conversion. Otherwise, the > sscanf function returns the number of input items assigned, > which can be fewer than provided for, or even zero, in the event > of an early matching failure." Yes, I knew that. > If the string is "" no conversion is done, hence EOF should be > returned. The string "abc" should also make it return EOF, if I've > understood correctly. That's not my reading of the standard. ``No conversion is done'' means we should return zero. EOF is for when there's ``an input failure'' (like if we cannot read from a file due to failure in the underlying DOS functions or some such). The only case in the context of sscanf where ``an input failure'' might happen is if the first argument is a NULL pointer. So I think our implementation adhers to the standard in these cases. (IIRC, we already had a similar discussion a few years ago, but perhaps in the context of fscanf. It might be useful to find that discussion in the archives.)