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=AWL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1A6E2BC6C for ; Fri, 18 Jan 2008 18:18:15 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAFNukEfUnw6DiGdsb2JhbACCNY1fAQEBCAQGERidKw X-IronPort-AV: E=Sophos;i="4.25,217,1199660400"; d="scan'208";a="6917362" Received: from pih-relay04.plus.net ([212.159.14.131]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Jan 2008 18:18:14 +0100 Received: from [80.229.56.224] (helo=beast.local) by pih-relay04.plus.net with esmtp (Exim) id 1JFur9-0006Yo-MB for caml-list@yquem.inria.fr; Fri, 18 Jan 2008 17:18:15 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Strange performances Date: Fri, 18 Jan 2008 17:11:30 +0000 User-Agent: KMail/1.9.7 References: <1200619933.6383.47.camel@benjamin-laptop> <1200675314.6345.32.camel@benjamin-laptop> <95513600801180905t2adcaf53u6d5f9c6a5acbd8a6@mail.gmail.com> In-Reply-To: <95513600801180905t2adcaf53u6d5f9c6a5acbd8a6@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801181711.30143.jon@ffconsultancy.com> X-Spam: no; 0.00; andrieu:01 -unsafe:01 -unsafe:01 ocaml:01 segfault:01 ocaml:01 frog:98 imho:01 wrote:01 wrote:01 rec:01 compile:01 caml-list:01 unsafe:01 benjamin:01 On Friday 18 January 2008 17:05:20 Olivier Andrieu wrote: > Salut, > > On Jan 18, 2008 5:55 PM, Benjamin Canou wrote: > > This code works perfectly : > > > > let list_of_string s = > > let rec list_of_string s i = > > try let e = s.[i] in e :: list_of_string s (succ i) > > with Invalid_argument "index out of bounds" -> [] > > in list_of_string s 0 > > well, until you compile with the -unsafe flag .... That is an argument against the -unsafe flag rather than against the above code, IMHO. None of the operations used here were unsafe and, in an ideal world, OCaml would never segfault on this safe code. I _really_ don't like the notion that OCaml can just screw up following out of bounds access because that is one of the main reasons I migrated to OCaml in the first place... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e