warning: '/*' within comment

Mark Brader msb at sq.sq.com
Fri Jun 8 11:41:00 AEST 1990


> /*
> Sample usage:
> 	mkscript src/*.c src/*.h src/makefile man/* readme > dist.txt
> */

Assuming that your source is in ASCII, the *appearance* of a /* inside
a comment may be obtained by using the sequence /, space, backspace, *.
Of course, some programs for displaying the file may elect to show ^H
for the backspace, so this won't always work.  There is no ANSI C problem
with this approach, at any rate, as anything is legal inside a comment.

The appearance of a */ can be obtained inside a comment similarly, but
I would term this usage so bizarre as to be misleading.

I would write the above comment as:

/*
 * Sample usage:
 * 	mkscript src/_*.c src/_*.h src/makefile man/_* readme > dist.txt
 *
 * (Ignore the _ characters; they are there to prevent "unclosed comment?"
 * warnings when this code is compiled!)
 */

And similarly using *_/file.c if */file.c was the usage.


-- 
Mark Brader	"Many's the time when I've thanked the DAG of past years
utzoo!sq!msb	for anticipating future maintenance questions and providing
msb at sq.com	helpful information in the original sources."	-- Doug A. Gwyn

This article is in the public domain.



More information about the Comp.std.c mailing list