<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Sep 12, 2013, at 5:49 PM, Dan Gohman <<a href="mailto:sunfish@google.com">sunfish@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Thu, Sep 12, 2013 at 5:00 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> wrote:<br><blockquote type="cite">llvm::outs() has a static local that closes stdout in its destructor.<br>Obviously, this *really* has to run atexit, and probably can't run at<br>llvm_shutdown() time.  Alternatively, it shouldn't close stdout.<br><br><br>Is the issue just that you want it to flush its output?<br></blockquote><br>The issue is that it needs to detect pending I/O errors.<br></div></blockquote><div><br></div><div>What would you do with pending I/O errors in an atexit() handler?</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite">In that case why not do the equivalent of _setvbuf?<br></blockquote><br>_setvbuf is for libc buffering. raw_ostream's implementation was<br>designed to avoid libc buffering because it wasn't as fast.<br></div></blockquote><div dir="auto"><br></div><div dir="auto">I understand that _setvbuf is for libc.  But why can't raw_ostream do the equivalent for the purpose of llvm::outs()?  Is the concern that a program might use outs() (i.e. outputting to stdout) so heavily that buffering becomes critical?</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>Dan</div></blockquote></div><br></body></html>