Jesus Cea wrote: > My point is: we are simplifying the program considering "0" a valid len > counter, but we complicates it because now the code can't consider "" = > EOF if it actually asked for 0 bytes. What are you suggesting read(0) *should* do, then? If it returns None or some other special value, or raises an exception, then you need a special case to handle that. So you've just substituted one special case for another. > Isaac Morland wrote: > > > The Unix read() system call doesn't treat EOF as special other than it > > won't return bytes from "beyond" EOF and therefore even when reading a > > regular file could return fewer (including 0) bytes than asked for in > > the call. No, that's not right -- a read of more than 0 bytes will always block until at least 1 byte is available, or something happens that counts as an EOF condition. However, with some devices it's possible for what counts as EOF to happen more than once, e.g. ttys. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4