emacs-devel
[Top][All Lists]
Advanced

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

Re: `message' not outputting the newline "atomically"


From: Paul Eggert
Subject: Re: `message' not outputting the newline "atomically"
Date: Wed, 26 Jun 2019 12:38:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1

Eli Zaretskii wrote:
Can't we also fix that by replacing the above with 'sprintf' followed
by 'write'?

Not easily. Using a fixed-size buffer and truncating the output would violate the GNU coding standards; using a PIPE_BUF-size buffer and looping until the output was done would be quite difficult to do with sprintf; and allocating the buffer on the heap would result in the usual buffer-management hassles such as potential leaks and dealing with allocation failures. In short, none of these alternatives are nearly as simple and reliable as line-buffered stderr. Even fully-buffered stderr (not a solution I favor) would be simpler and more reliable than trying to buffer stderr via sprintf+write.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]