Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!decwrl!shelby!agate!saturn!ucscb.UCSC.EDU!easterb From: easterb@ucscb.UCSC.EDU (William K. Karwin) Newsgroups: comp.lang.c++ Subject: Re: C++ Comments Summary: one of many possible fixes Message-ID: <7636@saturn.ucsc.edu> Date: 24 May 89 07:52:09 GMT References: <6957@brunix.UUCP> Sender: usenet@saturn.ucsc.edu Reply-To: easterb@ucscb.UCSC.EDU (William K. Karwin) Organization: University of California, Santa Cruz; CATS Lines: 22 In article <6957@brunix.UUCP> sdm@cs.brown.edu (Scott Meyers) writes: >Consider the following C++ source line: > > //********************** > >How should this be treated by the C++ compiler? The GNU g++ compiler >treats this as a comment-to-EOL followed by a bunch of asterisks, but the >AT&T compiler treats it as a slash followed by an open-comment delimiter. Some students ran into this problem, and the "macros-expanded-even- though-they're-in-comments" problem this school term, in a class using C++. We think one way to solve it is to have in a makefile: .c.o: @sed s/\\/\\/.\*// $< > $*.C CC $(CFLAGS) -c $*.C @/bin/rm -f $*.C The sed command strips // comments and all characters following on a line. We are using the .c suffix for our C++ code files. William Karwin, ...ucbvax!ucscc!ucscb!easterb