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
Unix.getuid() int overflow
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-31 (16:32)
From: Mathias Kende <mathias@k...>
Subject: [Caml-list] int overflow and Marshal failure
Le jeudi 30 août 2007 à 23:47 +0200, Markus E L a écrit :
> A check in the Unix library would be nice, in the long run I think
> using 32bit native integers is absolutely required. 

I had the same sort of problem with the Unix.stat function and the
st_size member being an int while it is a 64 bits int on recent systems
(including some 32 bits one). The maximum size that can be stored on 32
bits system, 1Go, is much too small for this function.

This lean me to an other, different but related, problem : marshaling a
value which contain an int on a 64 bits computer and then unmarshaling
it  on a 32 bits computer will raise an exception (Failure "input_value:
integer too large") if an int where bigger than max_int. while the
manual states than : "The format for the byte sequences is compatible
across all machines for a given version of Objective Caml."

Even if raising an exception is a "good" behaviour, it is still
impossible to read back the data and I think that there should be a way
to read back the data even in this case.