From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28361; Wed, 12 Jun 2002 10:08:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA28199 for ; Wed, 12 Jun 2002 10:08:29 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5C88Tb15788 for ; Wed, 12 Jun 2002 10:08:29 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28161 for caml-list@inria.fr; Wed, 12 Jun 2002 10:08:28 +0200 (MET DST) Date: Wed, 12 Jun 2002 10:08:28 +0200 From: Xavier Leroy To: caml-list@inria.fr Subject: Re: [Caml-list] Unix.file_descr -> int ??? Message-ID: <20020612100828.B26939@pauillac.inria.fr> References: <20020611213158.A680@max.home> <20020611174527.A14450@pauillac.inria.fr> <20020612022611.B680@max.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20020612022611.B680@max.home>; from max630@mail.ru on Wed, Jun 12, 2002 at 02:26:11AM +0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I was trying to trace a code with some significant amount of > select'ed fds. At some point, I faced the fact that I just > have no way to "show" a descriptor value. OK, if it's just for debugging, and only intended to run under Unix, you could use the following: external int_of_filedesc: Unix.file_descr -> int = "%identity" > I know almost nothing about win32, but I was very surprised > to discover that win32 has functions, isomorphic to > low-level unix calls. However, I suspect (I don't have win32 > headers to look in just now) that HANDLE is again a > "typedef" of intteger. Not really. It's a typedef of void *. Values of this type look like small integers, but no guarantees of this kind are given in the Win32 specs. Moreover, a Unix.file_descr under Windows is not a HANDLE, but a pair of a HANDLE and a flag saying whether it's a socket or not. See, we really need type abstraction to hide these details :-) And also to catch common errors like confusing the "fd" and "length" parameters to the read() or write() functions (in C). - Xavier Leroy ------------------- 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