| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| Date: | Thu, 2 Sep 2004 18:30:56 -0400 |
| Message-Id: | <200409022230.i82MUuqE006471@envy.delorie.com> |
| From: | DJ Delorie <dj AT delorie DOT com> |
| To: | djgpp AT delorie DOT com |
| In-reply-to: | <20040902221157.GB7970@webhome.cz> (message from Egon Eckert on |
| Fri, 3 Sep 2004 00:11:57 +0200) | |
| Subject: | Re: scanf: strange behavior? |
| References: | <20040902144152 DOT GH6858 AT webhome DOT cz> <2pp00iFnf7nsU1 AT uni-berlin DOT de> <41374c9c$0$173$cc7c7865 AT news DOT luth DOT se> <20040902184005 DOT GA23943 AT webhome DOT cz> <41378A42 DOT 5040801 AT acm DOT org> <200409022144 DOT i82LiDLe005751 AT envy DOT delorie DOT com> <20040902221157 DOT GB7970 AT webhome DOT cz> |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
> -- I'm becoming more and more confident, that it's actually
> inconsistent with the current implementation.
>
> To return EOF, the input has to end *before* the first item
> converted/assigned, because when it has to end otherwise? It has to
> end sometime... No word about conversion items pending.
The documentation is vague (heck, the standard is a little vague too).
The problem is that it doesn't say what happens when they're
successful conversions AND input ends prematurely. The normal case is
that you have a conversion for all your format specifiers before input
ends. The other two cases are a conversion error (wrong input) or end
of string (no input).
The appropriate test cases are thus, for "%d %d":
""
"x"
"5"
"5 x"
"5 5"
"5 5 x"
The first and third are the problem cases here.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |