From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Han-Wen Nienhuys Newsgroups: gmane.lisp.guile.devel Subject: Re: proposal: stricter type-checking for macros Date: Thu, 25 Mar 2004 16:34:54 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <16482.64542.175708.694774@localhost.localdomain> References: <16482.53029.540065.796985@localhost.localdomain> Reply-To: hanwen@xs4all.nl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1080229144 3698 80.91.224.253 (25 Mar 2004 15:39:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2004 15:39:04 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 25 16:38:29 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6Ww8-0002VS-00 for ; Thu, 25 Mar 2004 16:38:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6Wt2-0000MV-5u for guile-devel@m.gmane.org; Thu, 25 Mar 2004 10:35:16 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6Wsv-0000MA-AC for guile-devel@gnu.org; Thu, 25 Mar 2004 10:35:09 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6WsM-0000Cg-LY for guile-devel@gnu.org; Thu, 25 Mar 2004 10:35:05 -0500 Original-Received: from [213.84.26.127] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1B6WsM-0000C4-5l for guile-devel@gnu.org; Thu, 25 Mar 2004 10:34:34 -0500 Original-Received: from localhost.localdomain.byrd.xs4all.nl (byrd [127.0.0.1]) by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i2PFYsW8004766; Thu, 25 Mar 2004 16:34:54 +0100 Original-To: prj@po.cwru.edu (Paul Jarc) In-Reply-To: X-Mailer: VM 7.14 under Emacs 21.3.1 X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner: Found to be clean X-MailScanner-From: hanwen@xs4all.nl X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3570 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3570 prj@po.cwru.edu writes: > Han-Wen Nienhuys wrote: > > // #define TYPECHECK(x) (global_object = (x)) > > #define TYPECHECK(x) (0? (void)(*(SCM*)0=(x)): (void)0) > > Casting to void ensures that the resulting "value" won't accidentally > be used for anything. "0?" ensures that the null pointer won't > actually be dereferenced. I'd expect dead-code elimination to compile > this into nothing, but I haven't checked which optimization level this > happens for. Very clever! I vote for #define TYPECHECKED(x) (0? (*(SCM*)0=(x)): x) which returns x, and obviates the void casting. -- Han-Wen Nienhuys | hanwen@xs4all.nl | http://www.xs4all.nl/~hanwen _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel