Subject: Re: make and comments
To: Matthias Buelow <>
From: Greg A. Woods <>
List: tech-userlevel
Date: 07/27/2002 11:56:14
[ On Saturday, July 27, 2002 at 06:24:31 (+0200), Matthias Buelow wrote: ]
> Subject: Re: make and comments
> Greg A. Woods wrote:
> >Personally I think that "continued comments" are bogus and _dangerous_.
> >
> >A backslash in a comment is just a backslash.  It has no meaning,
> >special or otherwise.
> >
> >After all that's all the manual promises:
> >
> >     Comments begin with a hash (`#') character, anywhere but in a shell com-
> >     mand line, and continue to the end of the line.
> >
> It depends on the grammatical level you put "end of line" in...

No, I don't think so.  "to the end of the line" has a very explicit
meaning in this context, and indeed in the larger context of all common
Unix tools.

Note the description of a "line" and a "continued line":

     In general, lines may be continued from one line to the next by ending
     them with a backslash (`\').  The trailing newline character and initial
     whitespace on the following line are compressed into a single space.

The primary meaning of a basic "line" is clearly the unit of text
delimited by the first newline character following the previous one.

Indeed the original V7 manual was much clearer:

       Sharp and newline surround comments.

(though I don't believe it allowed continued lines anywhere)

However I'm certain that if the Berkeley folks had intended comments to
be "continued lines" and not "basic lines" that they would also have
very clearly stated this intention.  Such distinctions are quite
important and not making them clear would obviously be very confusing
for the user.

> In the argumentation of the standard, an end of line obviously can be 
> escaped.
> However, there's no point arguing about that.  The standard is not 
> ambiguous.

Indeed, however the standard does not describe the Berkeley Make program
and our version makes no claims about being compliant or even compatible
with any standard.

I think this is important because as has already been said, interpreting
escapes (or worse even more stuff) inside of a comment is quite
"dangerous" and can only lead to confusion.  Comment lines that continue
onto multiple lines because of escape processing are very rarely seen
and are most definitely the exception, and a commonly unexpected one at
that.  In this case the standard is broken (and in an unsafe way), and
conforming with it on this point is counter-productive.

Having written many parsers for configuration files which use the '#'
comment convention borrowed from the shell I can almost guarantee that
continued comment lines in any interpreter, which has accuired them
because of featuritis and not because of standards conformance, are an
accident of the implementation.

Besides, the Autoconf folks are the only ones I've ever heard of who've
tried to take advantage of continued lines in a scenario where portable
code is necessary and of late they've unfortunately been prone to doing
this quite often -- the current maintainers seem to have a tendency to
get blinded by features in the few make programs they commonly use.

								Greg A. Woods

+1 416 218-0098;            <>;           <>
Planix, Inc. <>; VE3TCP; Secrets of the Weird <>