Hacker News
points by JdeBP 2 days ago | 0 comments
It's worth noting that there are more that two kinds of buffering, contrary to the introduction here, and the one that's actually used in several C libraries is so-called smart buffering. This also flushes standard output when standard input needs to do an underlying read and it is reading the beginning of a line.

And since musl libc is in the news, it is worth nothing that musl's fwrite() is another of those that looks for the last linefeed in the buffer, rather than the first, and so should emit multiple lines in one underlying write(). Although this is only done in fwrite() specifically.

* https://git.musl-libc.org/cgit/musl/tree/src/stdio/fwrite.c#...

Aún no hay comentarios.
Hacker News