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 LAA32224; Wed, 12 Jun 2002 11:57:34 +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 LAA32150 for ; Wed, 12 Jun 2002 11:57:34 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5C9vVb22704; Wed, 12 Jun 2002 11:57:32 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id SAA21387; Wed, 12 Jun 2002 18:57:29 +0900 (JST) To: damien.doligez@inria.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unix.file_descr -> int ??? In-Reply-To: <200206120953.LAA0000032113@beaune.inria.fr> References: <200206120953.LAA0000032113@beaune.inria.fr> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020612185729P.garrigue@kurims.kyoto-u.ac.jp> Date: Wed, 12 Jun 2002 18:57:29 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Damien Doligez > >Windows version: > > > >let dump_handle (h : Unix.file_descr) = > > let obj = Obj.repr h in > > if Obj.is_block obj && Obj.tag obj = Obj.custom_tag then > > Nativeint.format "%x" (Obj.obj obj) > > else invalid_arg "dump_handle" > > This does not work. You are printing the address of the custom block > that contains the handle, but this address can change during program > execution. Indeed, this is buggy. But you could have given the right answer :-) let dump_handle (h : Unix.file_descr) = let obj = Obj.repr h in if Obj.is_block obj && Obj.tag obj = Obj.custom_tag then Nativeint.format "%x" (Obj.obj (Obj.field obj 1)) else invalid_arg "dump_handle" Jacques Garrigue ------------------- 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