Browse thread
exception safety / RAII ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <bhurt@s...> |
| Subject: | Re: [Caml-list] Re: exception safety / RAII ? |
On Sun, 6 Mar 2005, Stefan Monnier wrote: > > In most cases you probably won't care when a file is closed after writing to > > it, so you can just rely on the garbage collector. > > Very bad practice in (e.g.) an NFS world where the filesystem makes no > guarantee about file writes until you actually close the file. Ocaml does give you the close_out function to explicitly close an I/O stream. Closing on GC collection just catches the odd cases, like exiting the function unexpected (via an exception, for example). Brian