From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p7GGu2UQ027216 for ; Tue, 16 Aug 2011 18:56:03 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjAJAFGgSk5QW+UMgWdsb2JhbABBhAJGlGaPCQYCFAEBFiYlgUABAQQBDBcPATgTCwEIAhoCBSECAg8BBA0bGxmHcAKnbZF7gSyEDIEQBIdflSmDAYQc X-IronPort-AV: E=Sophos;i="4.68,234,1312149600"; d="scan'208";a="116009385" Received: from lo.gmane.org ([80.91.229.12]) by mail1-smtp-roc.national.inria.fr with ESMTP; 16 Aug 2011 18:55:57 +0200 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QtMvk-0007Xz-Ci for caml-list@inria.fr; Tue, 16 Aug 2011 18:55:56 +0200 Received: from 174.121.218.178 ([174.121.218.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 16 Aug 2011 18:55:56 +0200 Received: from jeffsco by 174.121.218.178 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 16 Aug 2011 18:55:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Jeffrey Scofield Date: 16 Aug 2011 11:55:43 -0500 Sender: jeffsco@pse.psellos.com Message-ID: References: <20110816152550.GA21081@annexia.org> <20110816155137.GA18365@ccellier.rd.securactive.lan> <20110816161042.GA31932@annexia.org> <20110816162205.GC31932@annexia.org> <20110816162719.GD31932@annexia.org> <4E4A9C17.7060605@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 174.121.218.178 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Validation-by: jeffsco@psellos.com Subject: [Caml-list] Re: Interfacing with C: bad practice Török Edwin writes: > But isn't this 'f(g(), x)' issue the same as the classic example > of undefined behaviour with f(++i, ++i)? It's not quite the same, because a function call (g()) introduces a sequence point. In the f(++i, ++i) case, I think there's only a sequence point after the call to f. I personally think the effect of f(x, g()) is unspecified if g() changes the value of x. I don't think the compiler is required to chase down dependencies like this, that's why the order of parameter passing is left unspecified. I've often worried about exactly this case when writing OCaml/C interfaces. I'm far from an expert, however. (One great thing about the ML family is that there are exceptionally clear answers to questions like this. Especially for Standard ML.) Jeffrey