Browse thread
int_of_string bug
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-03-30 (04:29) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] int_of_string bug |
On Thu, 2007-03-29 at 21:26 -0400, Yaron Minsky wrote: > On 3/29/07, Brian Hurt <bhurt@spnz.org> wrote: > > 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*. > > Not really all that consistent: > > # int_of_string "1073741824";; > - : int = -1073741824 > # int_of_string "1073741825";; > Exception: Failure "int_of_string". > # skaller@rosella:/work/felix/svn/felix/felix/trunk$ ledit ocaml Objective Caml version 3.10+dev25 (2007-03-26) # int_of_string "1073741824";; - : int = 1073741824 # int_of_string "1073741825";; - : int = 1073741825 -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net