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
[Caml-list] How hard would more inlining, more unboxed floats be?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-05-14 (16:55)
From: David Fox <dsfox@c...>
Subject: [Caml-list] in_channel_length fails for files longer than max_int
The pervasive function in_channel_length fails when the file size is
too large for an int, but it doesn't raise an exception.  The code in
io.c just checks for lseek errors.  Would a check for end > max_int be
worthwhile?

long channel_size(struct channel *channel)
{
  long end;

  end = lseek(channel->fd, 0, SEEK_END);
  if (end == -1 ||
      lseek(channel->fd, channel->offset, SEEK_SET) != channel->offset) {
    sys_error(NO_ARG);
  }
  return end;
}
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr