caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <pierre.weis@inria.fr>
To: alan.schmitt@polytechnique.org (Alan Schmitt)
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] scanf and %2c
Date: Thu, 19 Jun 2003 10:57:14 +0200 (MET DST)	[thread overview]
Message-ID: <200306190857.KAA12115@pauillac.inria.fr> (raw)
In-Reply-To: <20030613202820.GM9367@alan-schm1p> from Alan Schmitt at "Jun 13, 103 04:28:20 pm"

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


  reply	other threads:[~2003-06-19  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-13 20:28 Alan Schmitt
2003-06-19  8:57 ` Pierre Weis [this message]
2003-06-19 15:06   ` Nicolas George
2003-06-20  9:06 ` Pierre Weis
2003-06-20 10:45   ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200306190857.KAA12115@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=alan.schmitt@polytechnique.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).