line comments (## vs. //)

William LeFebvre phil at rice.ARPA
Tue Nov 27 00:26:56 AEST 1984


> > Couldn't you use something like 
> > 
> > 	# define // /*
>
> Doesn't work!

C'mon Doug.  The least you could have done is explained why!

The ## and // comments are "here-to-end-of-line" comments (thus the
name "line comments").  They behave in a fashion similar to the #
character in the assembler.  When a ## or // appears on a line, it
means "everything from here to the newline is a comment."  Now you
should see why the #define won't work.  Where will you get the */ from?

BTW:  // was used for comments in one of C's ancestors ... BCPL!  I
could get used to that type of comment again with little problem.  But
I don't understand the motivation behind such a switch.  Is it because
people miss the line commenting ability?  Is it just because some
people think /* */ is too ugly?  Or has someone actually been bitten by
the expression "c = *a/*b;" ???   :-)

                                William LeFebvre
				Department of Computer Science
				Rice University
                                <phil at Rice.arpa>



More information about the Comp.lang.c mailing list