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 CAA06345; Wed, 21 Jul 2004 02:54:43 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA04907 for ; Wed, 21 Jul 2004 02:54:42 +0200 (MET DST) Received: from narury.org (irkki.net [193.65.56.227]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6L0sfEV009367 for ; Wed, 21 Jul 2004 02:54:41 +0200 Received: (from xm@localhost) by narury.org (8.11.6/8.9.3) id i6L0sZt27872; Wed, 21 Jul 2004 03:54:35 +0300 Date: Wed, 21 Jul 2004 03:54:35 +0300 From: Jere Sanisalo To: Christophe Raffalli Cc: caml-list@inria.fr Subject: Re: [Caml-list] Calback Message-ID: <20040721035435.A27078@xmunkki.org> Reply-To: xm@xmunkki.org References: <40FC0BEF.4080909@univ-savoie.fr> <3B84CC2A-D97E-11D8-A7B0-00039310CAE8@inria.fr> <40FD79F9.6040309@univ-savoie.fr> <20040720.164053.104046716.andrieu@ijm.jussieu.fr> <40FD9FDE.3070000@univ-savoie.fr> <40FDA063.9080408@univ-savoie.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <40FDA063.9080408@univ-savoie.fr>; from christophe.raffalli@univ-savoie.fr on Tue, Jul 20, 2004 at 06:44:51PM -0400 X-Miltered: at nez-perce with ID 40FDBED1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sizeof:01 sizeof:01 expr:01 expr:01 runtime:01 runtime:01 typedef:01 int:01 int:01 assert:02 assert:02 compile:02 array:04 define:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > I'm afraid this will break on plaforms where `sizeof (int) != sizeof > > (long)'. >If it is still int, I could do a test in the C code and go through a C >array if (sizeof(int) != sizeof(void*)) Why not do something along the lines of: #define Meta_Assert(expr) typedef int __META_ASSERT__[(expr)? 1 : -1]; and then simply asserting it runtime? Like: Meta_Assert( sizeof(int) = sizeof(void*) ); Of course if you DO want it to work with different sizes, a different approach is wanted. But mostly thses kind of things are nice, as they check at compile time that certain truths about the runtime are true. -- Jere Sanisalo [xm@xmunkki.org] - http://www.xmunkki.org/ ------------------- 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