Re: view growbuf read until() suggestion



Hello,

> --- Ursprüngliche Nachricht ---
> Von: Roland Illig
> An: Pavel Tsekov
> Betreff: Re: view growbuf read until() suggestion
> Datum: Sat, 06 Aug 2005 04:03:05 +0200
> 
> Pavel Tsekov wrote:
> > Of course you might still be right in assuming that fread() may return
> less
> > bytes than requested. I can imagine that it could happen with a
> fdopen()-ed
> > FILE which has a file descriptor in non-blocking mode. This is of coure
> just
> > speculation. Of course, calls to feof() and ferror() could be added to
> > detect the situation where the read didn't fail but still returned less
> > data.
> 
> ISO C99, 7.19.3p3:
> [...] characters may be accumulated to or from the host environment as a 
> block. [...] characters are intended to be transmitted [...] when a 
> block is filled. [...]
> 
> The relevant part is the "may" and "are intended to". These are not 
> strict requirements, so we cannot rely on it.

Roland, you should know that the C standard is far less practical than an
actual implementation. The intended audience of the standard is not
application programmers but implementors. You are getting way too picky.
Holding the standard in one hand and pointing a finger with the other
doesn't seem very appropriate. The text that you quote is out of context
too. In any case I am not going to get involved into interpreting what the C
standard commitee had in mind.

Having said that I have to say that I like your patch because it is cleaner
and avoids some code duplication present in my patch. Of course I haven't
checked it against the bunch of possible standards that it might vioalte.

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl



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