[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: io:lines() and \0
- From: "Cezary H. Noweta" <chn@...>
- Date: Fri, 21 Feb 2014 17:13:59 +0100
On 2014-02-21 08:35, René Rebe wrote:
it does NOT say:
MAY copy, or clobber, additional bytes after the \n was encountered.
It *does* say this implicitly, i.e. it *does not* say this is
prohibited. In the simplest case, ,,fgets()'' can memset all an outut
buffer with zeroes at the beginning of its operation to verify that all
the buffer is writable. Untouched buffer is present solely in an
EOF-at-the-beginning case.
{To René: Your patch has one major disadvantage: it assumes that
the buffer will not be touched beyond terminating null character. In
general it *is not* true. Lua is sitting on top of C and not on top of
your implementation of C.}
,,fgets'' *is not* for reading zeroes (no matter: from text or from
binary streams). Using ,,fgets'' is ,,implementation detail'' which
should be mentioned in a documentation at least (or maybe, at most?).
BTW. It is unreasonable, how many can be told about differences between
text/binary streams, in the world, where 99.99% implementations *does
not* distinguish between them. :-)
-- best regards
Cezary H. Noweta
- References:
- io:lines() and \0, René Rebe
- Re: io:lines() and \0, steve donovan
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Enrico Colombini
- Re: io:lines() and \0, steve donovan
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Sean Conner
- Re: io:lines() and \0, Roberto Ierusalimschy
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Cezary H. Noweta
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Dirk Laurie
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Craig Barnes
- Re: io:lines() and \0, René Rebe