[libc-commits] [libc] [libc] Keep a stream buffered when setvbuf is passed no buffer (PR #236517)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Thu Oct 29 00:31:44 PDT 2026


labath wrote:

I can't find anything in the standards which would support your interpretation of the function behavior. [posix](https://pubs.opengroup.org/onlinepubs/9799919799/functions/setvbuf.html) is pretty fuzzy, and just says (emphasis mine): "otherwise, size ***may*** determine the size of a buffer allocated by the setvbuf() function", which might seem to leave the door open to ignoring the size argument. However, it also defers to the C standard, which is a bit stricter (the [cppreference](https://en.cppreference.com/c/io/setvbuf) page at least, I haven't checked the official document): "If `buffer` is a null pointer, resizes the internal buffer to `size`"

https://github.com/llvm/llvm-project/pull/236517


More information about the libc-commits mailing list