Xref: utzoo comp.unix.questions:6384 comp.unix.wizards:7539 comp.lang.c:8841 Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!sham.Berkeley.EDU!sarge From: sarge@sham.Berkeley.EDU (Steven Sargent) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: 3B2 cpp #ifdef + #include Message-ID: <2023@pasteur.Berkeley.Edu> Date: 2 Apr 88 11:10:51 GMT References: <109@iquery.UUCP> Sender: news@pasteur.Berkeley.Edu Reply-To: sarge@scam.berkeley.EDU Followup-To: comp.unix.questions,comp.lang.c Organization: XCF, People's Park, Styrofoam-Free City of Berkeley, CA. Lines: 58 Keywords: cpp 3B2 #ifdef #include In article <109@iquery.UUCP>, matt@iquery.UUCP (Matt Reedy) writes: > Has anyone else noticed this on the 3B2 (using C Programming Languages > Issue 4 Version 0)? > > Code fragment: > > #ifdef XXXXX > junk junk > #include junk > #endif > > main () > { > return 0; > } > > If it is compiled using 'cc -c -O junk.c', cpp says: > > junk.c: 3: bad include syntax > > Why is cpp trying to interpret the #include when the #ifdef is NOT true? > It doesn't complain about the 'junk junk' line, only the #include line! > > -- > Matthew Reedy harvard!adelie!iquery!matt > Programmed Intelligence Corp. (512) 822 8703 > 830 NE Loop 410, Suite 412 "just ONE MORE compile...." > San Antonio, TX 78209-1209 Ain't just 3b2, y'know: anybody using C 4.0 gets the same "benefit." I have to compile on UNIX and VMS, and so ran into this myself. Apparently TPC is running a full-employment program, and rather than building roads and dams, they keep busy by making annoying changes to cpp... here's another one: #ifdef vms do$vms$stuff$with$lots$of$signs #else vms do something else #endif vms The new improved cpp prints warnings about "tokens after directive (ignored)" after the #else and #endif lines. Not fatal to the compilation, but distracting to look at, and no help. (Yes, I can sed my source and fix the damn things -- certainly #endif /* vms */ is an acceptable solution. But why do they bother?) S. --- "I'm sorry... you must have me confused with some other plate-lipped white girl named Irene." -- Good Girls #2 Steven Sargent ARPA Internet: sarge@scam.berkeley.edu MILnet: sarge%scam.berkeley.edu@ucbvax.berkeley.edu TPCnet: {anywhere at all, really}!ucbvax!scam!sarge