Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Executable size?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florian Hars <hars@b...>
Subject: Re: [Caml-list] Executable size?
Brian Hurt wrote:
> I don't know how many times I've read or written C code like:
[...]
>     outf = fopen(dst, "wb");
>     if (outf == NULL) {
>         fclose(inf);
>         return errno;
>     }

> Vr.s the same code in Ocaml:
> 
> let copyfile src dst =
>     let inf = open_in_bin src
>     and outf = open_out_bin dst
>     and buf = String.make 4096 ' '
 >     in

[...]

This isn't the same code: The C version gets the ressource management right,
while the ocaml version leaks open files like hell.

See http://caml.inria.fr/archives/200307/msg00324.html and followups.

Yours, Florian.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners