comment style

Michael Condict condict at mirabeau.osf.fr
Wed Jan 9 16:07:35 AEST 1991


In <17968:Jan804:38:1591 at kramden.acf.nyu.edu>, brnstnd at kramden.acf.nyu.edu
(Dan Bernstein) writes:
 
>> However, as
>> another post points out, // comments can have there own pitfalls when
the line
>> ends with a '\'.
>
> No, not when they're done correctly. When you have end-of-line comments
> there's no need for continuation characters. *All* characters are
> ignored between // and newline inclusive.

This is an unwarranted generalization (that end-of-line comments
eliminate the need
for a continuation character), which doesn't really work in C.  For example, do
you really want to disallow the following?

	#define min_size 10  // Minimum size allowed for foo array
	#define max_size 20  // Maximum size allowed for foo array

Your proposal would require putting a blank line between the two #defines.
Also, you said that the comment would turn into a space, rather than simply
being deleted, which I agree is necessary in order to separate the token
preceding
it from the first token on the next line.  But then how do you get the
effect of:

	s = "123456789abcdefghijklmnopqrstuvwxyz\
	ABCDEFGHIJKLMNOPQRSTUVWXYZ";

using your comment notation?  Even assuming the comment delimiter is to be
recognized inside of quotes, a bad idea in itself, you would produce an
unwanted blank character in the string.

Michael Condict 
	



More information about the Comp.std.c mailing list