www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/02/00:54:35

Xref: news2.mv.net comp.os.msdos.djgpp:2346
From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: another bug of scanf?
Date: Mon, 01 Apr 1996 07:46:13 -0800
Organization: Alcyone Systems
Lines: 18
Message-ID: <315FFA45.4884D975@alcyone.com>
References: <199603300124 DOT UAA19709 AT delorie DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Toru Suzuki wrote:

> Nevertheless scanf() of almost UNIX returns EOF(-1) if the input ends
> before the first conflict or conversion, it seems that V2 returns
> NULL(0). Is this bug, or not?

ANSI dictates that the ...scanf family should return EOF upon input failure
before _any_ conversion.  Otherwise it returns the number of input items
assigned.  If a matching failure occurs early on, this _can_ be zero.  That
is, returning 0 because of an early failure is correct behavior.  It only
returns EOF if input ends before anything is matched.

-- 
Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com
San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_

- Raw text -


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