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 KAA11982; Thu, 19 Jun 2003 10:57:17 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA11742 for ; Thu, 19 Jun 2003 10:57:16 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5J8vEH23584; Thu, 19 Jun 2003 10:57:14 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA12115; Thu, 19 Jun 2003 10:57:14 +0200 (MET DST) From: Pierre Weis Message-Id: <200306190857.KAA12115@pauillac.inria.fr> Subject: Re: [Caml-list] scanf and %2c In-Reply-To: <20030613202820.GM9367@alan-schm1p> from Alan Schmitt at "Jun 13, 103 04:28:20 pm" To: alan.schmitt@polytechnique.org (Alan Schmitt) Date: Thu, 19 Jun 2003 10:57:14 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; pierre:01 weis:01 caml-list:01 scanf:01 users':01 char:01 mli:01 runtime:01 cristal:01 caml:01 type-checker:02 string:03 lesser:03 parse:04 stuff:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour Alan, > As I needed to parse some string representing time (of the form hh:mm), [...] Welcome to the dates and time users' camp! Too bad that there is no support for that kind of stuff in our favorite language :( > So shouldn't there be a warning (or an error) when using a size field > with chars ? > > Alan We must be a bit more precise than that: we should check that the size field is positive and lesser or equal than 1. In effect: - a 0 sized char scanf specification has a special useful meaning (see Scanf.mli for details): it means ``pick'' the current character without reading it (in order to test its value and decide what to do next), - a 1 sized char scanf specification seems to be harmless. I will try to had a static check in the type-checker (the usual Caml way), orelse a runtime failure in Scanf (the usual way of more conventional programming languages). Amicalement, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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