Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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*.

Brian