Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 49409 invoked from network); 28 Jun 2004 18:11:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 28 Jun 2004 18:11:34 -0000 Received: (qmail 75123 invoked by uid 500); 28 Jun 2004 18:11:17 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 74965 invoked by uid 500); 28 Jun 2004 18:11:13 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 74749 invoked by uid 99); 28 Jun 2004 18:11:11 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=PRIORITY_NO_NAME,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received: from [80.91.224.249] (HELO main.gmane.org) (80.91.224.249) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 28 Jun 2004 11:11:09 -0700 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Bf0ad-0003w7-00 for ; Mon, 28 Jun 2004 20:10:47 +0200 Received: from dyn-83-157-76-223.ppp.tiscali.fr ([83.157.76.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jun 2004 20:10:47 +0200 Received: from gmane by dyn-83-157-76-223.ppp.tiscali.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jun 2004 20:10:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: dev@httpd.apache.org From: "Charlie Gordon" Subject: Re: bug in header files Date: Mon, 28 Jun 2004 20:12:49 +0200 Lines: 35 Message-ID: References: X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dyn-83-157-76-223.ppp.tiscali.fr X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4939.300 Sender: news X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Monday, Patrick W. thus responded: Indeed.. Where does that construct come from? > printf("'N' = %d <-> FALSE[\"NY\"] = %d\n", 'N', FALSE["NY"]); I have never seend TRUE["NY"], and would have guessed cpp would change it to 1["NY"] which doesn't mean anything to me. It appears to want to be "NY"[1] ?! How come it works? --------- I guess the example code requires some explaining: In the first case, TRUE["NY"] expands to 1["NY"] which is semantically interpreted as *(1 + "NY") and therefore computes to 'Y'. Whereas in the second case, TRUE["NY"] expands to !FALSE["NY"] which in turn expands to !0["NY"] . That computes to !*(0 + "NY") simplified into !*"NY" or !'N' finally resulting in the integer value 0. Unbeknownst to the vast majority of C programmers, subscripting in C is indeed commutative: p[i] is the same as *(p + i) same as *(i + p) or i[p]. I've seen it used in obfuscated C code contest submissions, in C puzzles, and similar teasing tests. Enjoy, Charlie Gordon, The C teaser