[PATCH] backslash-space-newline in comments
Zack Weinberg
zackw@Stanford.EDU
Wed Apr 11 14:59:00 GMT 2001
On Wed, Apr 11, 2001 at 07:51:34PM +0100, Neil Booth wrote:
> Jakub Jelinek wrote:-
>
> > IMHO we should not handle
> > // \<space><newline>
> > as multi-line comment, unlike outside of comment where this is most
> > definitely a bug, I guess it is much more common that white space in comment
> > is added after \ so that it would not result in a multi-line comment than
> > that anybody wants a multi-line comment and just has left unintentionally
> > space at the end.
> > E.g. http://www.cs.utwente.nl/~tcm is one of the things which now trigger the
> > multi-line comment warnings.
>
> Ugh, I guess it's a good idea, though I'm not 100% convinced. I'd
> like to know what Zack thinks. Why have single-line comments with
> \<space> at the end; what does the final \ provide?
>From Jakub's test case, things like this:
// \
// \
// >--------->
// /
// /
with trailing spaces after each backslash, which the authors intended
to inhibit interpretation as \-newline.
I don't have a lot of sympathy for this sort of game. /* */ comments
exist for a reason.
If we're going to do something, my suggestion is that we instead
suppress the \-newline in // warning, whether or not there's
intermediate whitespace, when the next line contains only a //
comment. The \-newline then has no effect on the meaning of the
program. I'm not sure how practical this is to implement.
zw
More information about the Gcc-patches
mailing list