Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcsun!unido!uniol!lehners From: lehners@uniol.UUCP (Joerg Lehners) Newsgroups: comp.lang.c Subject: Re: quotes inside #if 0 Keywords: ANSI, comments Message-ID: <830@uniol.UUCP> Date: 6 Sep 89 22:41:27 GMT References: <2014@munnari.oz.au> <14512@haddock.ima.isc.com> <2023@munnari.oz.au> <766@ecrcvax.UUCP> Organization: University of Oldenburg, W-Germany Lines: 35 diomidis@ecrcvax.UUCP (Diomidis Spinellis) writes: >[some text deleted] >ecrcvax% cat t.c >#if 0 >#funny_text >/* >#endif >ecrcvax% /bin/cc -c t.c >t.c: 2: undefined control >t.c: 5: unterminated comment >Vanila pcc complains about unbalanced comments and undefined preprocessor >controls inside #if 0 blocks. Commenting out arbitrary text with #if 0 is >not a safe practice for most compilers (both ANSI and classic C). I think the preprocess must look at the code following the #if 0 because the preprocessor must look for the corresponding #endif. And the rules for the preprocessor are: don't do any substitutions an interpretation in constant character arrays (""), character constants ('') and comments (/* */). But the idea of non-interpreting #if 0 / #endif pairs would be very nice: to (totally) comment out a full chunk of nontestet, non " and ' balanced code but /* */ balanced code, without worrying about recursive comments. Joerg -- / Joerg Lehners | Fachbereich 10 Informatik ARBI \ | | Universitaet Oldenburg | | BITNET/EARN: 066065@DOLUNI1.BITNET | Ammerlaender Heerstrasse 114-118 | | UUCP/Eunet: lehners@uniol.uucp | D-2900 Oldenburg | +-------------------------------------+----------------------------------+ \ Unix-Wizards: let's zap away all stupid users. /