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] bigarrays and toplevel on Win32?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-03-08 (10:24)
From: John Prevost <jmp@a...>
Subject: Re: [Caml-list] bigarrays and toplevel on Win32?
>>>>> "dg" == Dan Grossman <danieljg@cs.cornell.edu> writes:

    dg> No.  If I could be guaranteed a core dump on my first
    dg> out-of-bounds access, I would be fine with this.  It's why my
    dg> C code sometimes doesn't check for null before dereferencing a
    dg> pointer.  But with arrays, you can silently corrupt arbitrary
    dg> memory.  Maybe your program crashes later.  Maybe it ends up
    dg> deleting all your files.  Maybe it never tells you that it
    dg> computed the wrong answer.

    dg> What I would be okay with was doing the bounds-check and
    dg> exiting (or core dumping if you prefer) on out-of-bounds.
    dg> This still gives an optimizer some leeway because
    dg> array-intensive code will have fewer exception-causing
    dg> instructions.

You have a good point here--I was just being cheeky.

I really look at the unsafe array operations as akin to the unsafe
magic cast operation.  None of them are appropriate for everyday
use--but if I go over a small piece of code with a fine-toothed comb
and prove to my satisfaction that everything is correct, it's
worthwhile to have them.  They're not the most ideologically sound
tools available, but I appreciate that O'Caml tends to balance
ideology with practicality more often than the other guys seem to.

To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr