Date: Sun, 7 Jun 1998 12:05:13 -0500 (CDT) From: Joel Ray Holveck <joelh@gnu.org> To: dag-erli@ifi.uio.no Cc: mph@pobox.com, mike@smith.net.au, hackers@FreeBSD.ORG Subject: Re: Irritating cpp feature Message-ID: <199806071705.MAA17835@detlev.UUCP> In-Reply-To: <xzp4sxx452r.fsf@hrotti.ifi.uio.no> (dag-erli@ifi.uio.no) References: <199806070753.AAA04355@antipodes.cdrom.com> <19980607084415.A261@flarn.dyn.ml.org> <xzp4sxx452r.fsf@hrotti.ifi.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806071705.MAA17835>