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 MAA11253; Wed, 10 Oct 2001 12:31:20 +0200 (MET DST) 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 MAA11024 for ; Wed, 10 Oct 2001 12:31:19 +0200 (MET DST) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9AAVI127376 for ; Wed, 10 Oct 2001 12:31:18 +0200 (MET DST) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id f9AAVIN98673 ; Wed, 10 Oct 2001 12:31:18 +0200 (CEST) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.9.2/jb-1.1) id MAA14545 ; Wed, 10 Oct 2001 12:31:17 +0200 (MET DST) Date: Wed, 10 Oct 2001 12:31:17 +0200 (MET DST) From: Alain Frisch To: Johann Spies cc: ocaml mailing list Subject: Re: [Caml-list] out-of-bound array or string access In-Reply-To: <874rp7reh8.fsf@bywoner.sun.ac.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 10 Oct 2001, Johann Spies wrote: > Why did "if Array.length Sys.argv <> 4 then " not catch this? > > The code: ... > let bedrag = float_of_string Sys.argv.(1);; > let rentekoers = float_of_string Sys.argv.(2);; > let jare = float_of_string Sys.argv.(3);; > > let main() = if Array.length Sys.argv <> 4 then ... Toplevel phrases are executed in order, so the code want to access Sys.argv.(1,2,3) before the test. -- Alain Frisch ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr