From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA13024; Thu, 13 Nov 2003 14:37:59 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA12690 for ; Thu, 13 Nov 2003 14:37:58 +0100 (MET) Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [217.110.154.194]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hADDbv105546 for ; Thu, 13 Nov 2003 14:37:57 +0100 (MET) Received: from bik-gmbh.de ([192.168.125.193]) by grisu.bik-gmbh.de (8.12.8p2/8.12.8) with ESMTP id hADDblD5015147; Thu, 13 Nov 2003 14:37:48 +0100 (CET) (envelope-from hars@bik-gmbh.de) Message-ID: <3FB38926.90907@bik-gmbh.de> Date: Thu, 13 Nov 2003 14:37:42 +0100 From: Florian Hars User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 X-Accept-Language: en-us, de-de, en MIME-Version: 1.0 To: Brian Hurt CC: caml-list@inria.fr Subject: Re: [Caml-list] Executable size? References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-2.6 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; florian:01 hars:01 hars:01 bik-gmbh:01 caml-list:01 errno:01 florian:01 bin:01 bin:01 ocaml:01 ocaml:01 caml:01 null:01 buf:01 leaks:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Brian Hurt wrote: > I don't know how many times I've read or written C code like: [...] > outf = fopen(dst, "wb"); > if (outf == NULL) { > fclose(inf); > return errno; > } > Vr.s the same code in Ocaml: > > let copyfile src dst = > let inf = open_in_bin src > and outf = open_out_bin dst > and buf = String.make 4096 ' ' > in [...] This isn't the same code: The C version gets the ressource management right, while the ocaml version leaks open files like hell. See http://caml.inria.fr/archives/200307/msg00324.html and followups. Yours, Florian. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners