From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 649E1BBAF for ; Fri, 23 Jan 2009 16:53:51 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtkBAGF3eUmAArkpkWdsb2JhbACBbZIRAQEBAQkLCgcRBak7hkuILoVz X-IronPort-AV: E=Sophos;i="4.37,312,1231110000"; d="scan'208";a="20069069" Received: from chokecherry.srv.cs.cmu.edu ([128.2.185.41]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Jan 2009 16:53:50 +0100 Received: from stratocaster.home (pool-98-111-219-222.pitbpa.fios.verizon.net [98.111.219.222]) (authenticated bits=0) by chokecherry.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id n0NFrm8s022894 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 23 Jan 2009 10:53:48 -0500 (EST) Received: from ecc by stratocaster.home with local (Exim 4.69) (envelope-from ) id 1LQOLr-00086S-Ut for caml-list@yquem.inria.fr; Fri, 23 Jan 2009 10:53:47 -0500 Date: Fri, 23 Jan 2009 10:53:47 -0500 From: Eric Cooper To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] (Not) corrupt output of printf Message-ID: <20090123155347.GB30153@localhost> Mail-Followup-To: caml-list@yquem.inria.fr References: <4978AB4C.7000900@uj.edu.pl> <4979A803.4050603@wp.pl> <20090123131638.GA32545@annexia.org> <4979D239.9010208@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4979D239.9010208@wp.pl> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: mimedefang-cmuscs on 128.2.185.41 X-Spam: no; 0.00; printf:01 ocaml:01 23,:98 2009:98 wrote:01 incompatible:01 caml-list:01 functions:01 exits:02 output:02 output:02 flush:03 flush:03 bytes:03 element:03 On Fri, Jan 23, 2009 at 02:20:41PM +0000, Dawid Toton wrote: > Let's see the output as a sequence of bytes (there's no time). > Assuming that the process exits normally and incompatible printing > functions are not mixed: > is there a guarantee (in OCaml library) that the flush operation doesn't > 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