avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] sscanf


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] sscanf
Date: Fri, 12 Aug 2005 09:39:06 +0200
User-agent: Mutt/1.4.2.1i

As David Breeze wrote:

> Whilst not the ANSI text K & R second edition also says "It returns
> as its value the number of successfully matched and assigned input
> items"

The standard (draft) says:

``The fscanf function returns the value of the macro EOF if an input
failure occurs'' before any conversion. Otherwise, the 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.

Together with the remainder of the fscanf description, this obviously
was a bit too ambiguous to me when I implemented the function.
Descriptions in other sources like the Linux manual then subsequently
start talking about successful conversions in the next sentence, and
the description of the asterisk makes no explicit mention whether this
it to be accounted on the returned result anyway or not.  But I agree
that it appears the intention was to return the number of *actual*
assignments, and if all other vfscanf implementations agree on this as
well, we should do the same.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]