Mail Archives: djgpp-workers/2003/08/08/11:40:41
> From: Martin Stromberg <eplmst AT epl DOT ericsson DOT se>
> 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.)
- Raw text -