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-07 (16:00)
From: Dan Grossman <danieljg@c...>
Subject: Re: [Caml-list] bigarrays and toplevel on Win32?

John Prevost wrote:
> >>>>> "xl" == Xavier Leroy <Xavier.Leroy@inria.fr> writes:
>     xl> The party line on unsafe array accesses is unclear: on the one
>     xl> hand, we do not want to encourage their use, as it can break
>     xl> type safety and dramatically reduce the safety of the
>     xl> programs; on the other hand, they are handy when benchmarking
>     xl> against C or Fortran :-)
> Think of it less as an "unsafe array access" and more of "license to
> turn a given set of exceptions into core dumps in exchange for
> efficiency."  ;)
> John.

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

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


| Dan Grossman     www.cs.cornell.edu/home/danieljg H:607 256 0724 |
| 5157 Upson Hall  danieljg@cs.cornell.edu          O:607 255 9834 |
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr