From owner-freebsd-hackers Sun Jun 7 10:05:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA01605 for freebsd-hackers-outgoing; Sun, 7 Jun 1998 10:05:34 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mail.camalott.com (root@[208.203.140.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA01600 for ; Sun, 7 Jun 1998 10:05:24 -0700 (PDT) (envelope-from joelh@gnu.org) Received: from detlev.UUCP (tex-109.camalott.com [208.229.74.109] (may be forged)) by mail.camalott.com (8.8.7/8.8.5) with ESMTP id MAA26282; Sun, 7 Jun 1998 12:04:17 -0500 Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.8) id MAA17835; Sun, 7 Jun 1998 12:05:13 -0500 (CDT) (envelope-from joelh) Date: Sun, 7 Jun 1998 12:05:13 -0500 (CDT) Message-Id: <199806071705.MAA17835@detlev.UUCP> To: dag-erli@ifi.uio.no CC: mph@pobox.com, mike@smith.net.au, hackers@FreeBSD.ORG In-reply-to: (dag-erli@ifi.uio.no) Subject: Re: Irritating cpp feature From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <199806070753.AAA04355@antipodes.cdrom.com> <19980607084415.A261@flarn.dyn.ml.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >> I think there is something correct about our preprocessor. I Don't >> Have The Standard In Front Of Me (TM) but I think code that is >> #ifdef'ed out must still be syntactically correct, so the sample that >> you provided above is incorrect code. If somebody is using #ifdef >> around English text, that is wrong. > I can't find anything specific in the draft proposal, but common sense > says it has to be at least *lexically* correct (and a single quote > with no correpsonding closing quote is not lexically correct) unless > your preprocessor is built around a DWIM engine :) ANSI dictates that the #if'd out code must still consist of "valid preprocessing tokens". Since the preprocessor will tokenize string and char literals, then that is correct. (References: ANSI X3.159-1989 Sec. 2.1.1.2 & Sec. 3.1, ISO 9899:1990 Sec. 5.1.1.2 & Sec. 6.1, comp.lang.c FAQ 11.19, _C:_A_Reference_Manual_ (Harbison & Steele) Sec. 3.2 p40.) The draft 5.1.1.2 still shows the tokenizing performed before preprocessing directive execution. None of this helps Mike compile the program, but at least we don't need to be concerned that our preprocessor isn't compliant. Happy hacking, joelh -- Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan Fourth law of programming: Anything that can go wrong wi sendmail: segmentation violation - core dumped To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message