Version française
Home     About     Download     Resources     Contact us    
Browse thread
Suggested addition to Unix module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Judicael Courant <Judicael.Courant@e...>
Subject: Re: Suggested addition to Unix module

Hello,

>
>Also, is there a way to cast in OCaml instead of doing what I've done
>here, when you know the internal representations of two types are the
>same?  I realize this could be abused, turning OCaml into C, but then
>what I did below is kind of silly too.  Thank you.
>

you should consider using the function magic of module Obj... it is a
more generic implementation of your functions fd_of_descr and
descr_of_fd.

Judicael.
-- 
Judicael.Courant@ens-lyon.fr, http://www.ens-lyon.fr/~jcourant/
tel : (+33) 04 72 72 85 82
Beware of bugs in the above code; I have only proved it correct, not tried it.
                -- Donald Knuth