<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/687b7043920357f05d52e3fd913a1832"
  from="Eric Cooper &lt;ecc@c...&gt;"
  author="Eric Cooper"
  date="2009-01-23T15:53:51"
  subject="Re: [Caml-list] (Not) corrupt output of printf"
  prev="2009/01/bc5802fbe883e02d5f360e5c664d859e"
  next="2009/01/eeab0b3f120e211f21893e022df9ede5"
  prev-in-thread="2009/01/5d29f0ed559cefbbf25d94935aa405b8"
  prev-thread="2009/01/f6735e5adf3e71e22f286197791245f5"
  next-thread="2009/01/fa9227573533dbb2e2f2c661349a8632"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Corrupt output of printf">
<msg 
  url="2009/01/e4715fef3a3c4def40473db2f9f4e252"
  from="Dawid Toton &lt;dawid.toton@u...&gt;"
  author="Dawid Toton"
  date="2009-01-22T17:22:23"
  subject="Corrupt output of printf">
<msg 
  url="2009/01/c631394ba385c68b864e884371aa9051"
  from="Dawid Toton &lt;d0@w...&gt;"
  author="Dawid Toton"
  date="2009-01-23T11:20:41"
  subject="Re: [Caml-list] (Not) corrupt output of printf">
<msg 
  url="2009/01/07f8ae5aeb654567b36bd16c1f625f44"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2009-01-23T13:16:39"
  subject="Re: [Caml-list] (Not) corrupt output of printf">
<msg 
  url="2009/01/5d29f0ed559cefbbf25d94935aa405b8"
  from="Dawid Toton &lt;d0@w...&gt;"
  author="Dawid Toton"
  date="2009-01-23T14:20:48"
  subject="Re: [Caml-list] (Not) corrupt output of printf">
<msg 
  url="2009/01/687b7043920357f05d52e3fd913a1832"
  from="Eric Cooper &lt;ecc@c...&gt;"
  author="Eric Cooper"
  date="2009-01-23T15:53:51"
  subject="Re: [Caml-list] (Not) corrupt output of printf">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Fri, Jan 23, 2009 at 02:20:41PM +0000, Dawid Toton wrote:
&gt; Let's see the output as a sequence of bytes (there's no time).
&gt; Assuming that the process exits normally and incompatible printing  
&gt; functions are not mixed:
&gt; is there a guarantee (in OCaml library) that the flush operation doesn't  
&gt; affect the output?

The flush operation only relates to the time at which the write
occurs (i.e., flush may make it occur sooner than it would otherwise).
So if you're ignoring the time element (and error cases like writing
to a full disk or a broken pipe), it's unobservable.

But if the output is part of a larger interactive system -- prompting
a user for input, or engaging in a 2-way protocol with another process
-- then flushing can be essential for correct behavior.

-- 
Eric Cooper             e c c @ c m u . e d u

</contents>

</message>

