Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] 32-bit unsigned integers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Boris Yakobowski <ml@y...>
Subject: Re: [Caml-list] 32-bit unsigned integers
On Mon, Jul 26, 2004 at 10:49:25AM -0700, Corey O'Connor wrote:
> On Mon, 26 Jul 2004 19:15:18 +0200, Sébastien Hinderer
> <sebastien.hinderer@ens-lyon.org> wrote:
> > Now I'd like to define the same thing in Caml:
> > 
> > # let uint32_max = Int32.of_string "4294967295";;
> > Exception: Failure "int_of_string".
>
> Ah! I asked the same question just a bit ago!
> 
> A "language extension" to Ocaml (Make sure you have 3.07.11 or
> greater) is to directly assign 32 bit integers without using
> Int32.of_string. Just add an "l" to the end of the constant. (Lower
> case "L" if your font is strange and it looks like a 1 | I) It's like
> so:
> 
> # let blah = 0x8FFFFFFFl;;
> val blah : int32 = -1879048193l
> #

Unfortunately, this is still not enough in Ocaml 3.08 for the unsigned
integers needed by Sebastien:

        Objective Caml version 3.08

# 4294967295l;;
Integer literal exceeds the range of representable integers of type int32
# 

-- 
Boris

-------------------
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