English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
int_of_string bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-30 (01:08)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] int_of_string bug

On Thu, 29 Mar 2007, Yaron Minsky wrote:

> So, there's a weird int_of_string bug where positive decimal numbers are
> sometimes read in as negative numbers without error.  Here's the bug:
> http://caml.inria.fr/mantis/view.php?id=0004210

I'm actually not sure this is a bug either.  Note that ocaml will quite 
happily compute max_int+1 without an error either.

Wether this behavior (silent wrap around) is correct or not is another 
argument.  Elsewhere I have opinioned that the only purpose for having 
more than one type of integer in your programming language is so that 
programmers can pick the wrong one.  But I'm widely known to be a heretic.

Ocaml's behavior is, at least, *consistent*.