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 QAA10479; Fri, 20 Jul 2001 16:01:12 +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 QAA10475 for ; Fri, 20 Jul 2001 16:01:11 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6KE0ab23696; Fri, 20 Jul 2001 16:00:36 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA10469; Fri, 20 Jul 2001 16:00:36 +0200 (MET DST) Date: Fri, 20 Jul 2001 16:00:36 +0200 From: Xavier Leroy To: "Alexander V. Voinov" Cc: caml Subject: Re: [Caml-list] Data_custom_val(v) Message-ID: <20010720160036.G9351@pauillac.inria.fr> References: <3B510B1B.4552AFA1@quasar.ipa.nw.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3B510B1B.4552AFA1@quasar.ipa.nw.ru>; from avv@quasar.ipa.nw.ru on Sat, Jul 14, 2001 at 08:16:43PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I forgot to mention that Data_custom_val(v) doesn't allow for > assignments in C++, instead I have to use > > value blk = alloc_custom(...); > *(void **)&(Field(blk, 1)) = (void *)some_data; Don't do that, because someday the data part of the custom block may not be at offset 1. What is wrong with value blk = alloc_custom(...); mytype * mydata = (mytype *) Data_custom_val(v); *mydata = ; or, more concisely, *((mytype *) Data_custom_val(v)) = ; Is it that evil C++ that don't let you do that? - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr