Article View: gnu.gcc.help
Article #53404Re: Preprocessor questions: quotes and slashes
From: Dennis Jespersen
Date: Thu, 16 Jan 1992 12:43
Date: Thu, 16 Jan 1992 12:43
35 lines
2355 bytes
2355 bytes
>>>>> On 16 Jan 92 06:28:16, jesperse@nas.nasa.gov (Dennis Jespersen) said: >> I have a quick question on the "proper" treatment of single quotes and >> slashes. Consider the following 2-line file: >> c let's check this >> & 'and this'////) >> When I run it through /lib/cpp on my machine (a NeXT running 2.1 and >> GNU CPP version 1.36) I get the output (indented for clarity) >> testcpp.tmp:1: unterminated string or character constant >> # 1 "testcpp.tmp" >> c let's check this >> & 'and this' >> Is the complaint about line 1 correct? The complaint goes away if I >> use the -traditional switch to /lib/cpp. And how about the second >> line? Why are all the slashes and the parenthesis removed? I've >> tried this on several other machines (Sun, Iris, VAX/ULTRIX) and never >> had this result. I've looked at the GNU docs and haven't been able to >> find anything explaining this behavior. I can answer my own question about the slashes, at least: the double slash signals the start of a comment in c++ and Objective-C, so the preprocessor by default removes it. To get the // to not be removed it suffices to give the -C switch to the preprocessor. I'm still not sure why the preprocessor complains about the single quote in the first line -- yes, it's obviously looking for a matching quote but why? -- Dennis Jespersen MS 202A-1 NASA Ames Research Center Moffett Field, CA 94035-1000 Voice: (415) 604-6742 FAX: (415) 604-1095 email: jesperse@rft28.nas.nasa.gov We have met the enemy and he is us. -- Pogo
Technical Details
Message-ID:
<JESPERSE.92Jan16064304@rft28.nas.nasa.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!eos!data.nas.nasa.gov!data!jesperseReferences:
<JESPERSE.92Jan16062816@rft28.nas.nasa.gov>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,fa187774b4ad0fad X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-01-16 14:49:00 PST Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!eos!data.nas.nasa.gov!data!jesperse From: jesperse@nas.nasa.gov (Dennis Jespersen) Newsgroups: gnu.gcc.help Subject: Re: Preprocessor questions: quotes and slashes Message-ID: <JESPERSE.92Jan16064304@rft28.nas.nasa.gov> Date: 16 Jan 92 12:43:04 GMT References: <JESPERSE.92Jan16062816@rft28.nas.nasa.gov> Sender: news@nas.nasa.gov Distribution: gnu Organization: Computational Fluid Dynamics Branch, NASA Ames Research Center Lines: 35 In-Reply-To: jesperse@nas.nasa.gov's message of 16 Jan 92 06:28:16