can we define a comment?

David Fang fang@csl.cornell.edu
Tue May 16 03:43:00 GMT 2006


> But, I don't want take this function-like  way.
>
> 2006/5/16, corey taylor <corey.taylor@gmail.com>:
> > Kind of an odd request, but I suppose that you could do something like:
> >
> > #define CMNT(exp)
> >
> > But then you'd have to wrap the comment:
> >
> > CMNT(this is a comment)

If you insist on the following comment-style:

COMMENT ... stuff to read ...

you might as well pre-preprocess your source with another filter.

[Makefile]
# Converts .cpp-sed to .cpp file by applying sed filter.
.cpp-sed.cpp:
	sed '/^COMMENT/d' $< > $@
[EOF]

This could be a poor-man's way of prepending your compile-chain with
another tool.  (Generalize to your favorite scripting or
stream-editing language, if you like.)

BTW, 'm4' is another powerful preprocessor, whose comment-style is
programmable, if you really want some sophistication.  (Probably overkill,
IMO.)

Fang



More information about the Gcc-help mailing list