defining a comment?

Ed Vopata vopata at ksuvax1.cis.ksu.edu
Fri Sep 23 08:27:10 AEST 1988


In article <855 at vsi.UUCP> friedl at vsi.UUCP (Stephen J. Friedl) writes:
>In article <5438 at techunix.BITNET>, benny at techunix.BITNET (Benny Pinkas) writes:
>>
>> Can I use the Preprocessor to define a comment? I mean something like:
>> 
Yes!  The following in a sample program which will demonstrate the use of
STARTCOM and ENDCOM macros for defining the beginning and ending of a C
Comment.  Also included is the output of the preprocessor (cc -E).  I have 
compiled this program on a couple of C compilers (one provided with 4.3 BSD
and one provided by AT&T) and the program works.

Please note that in the "#define STAR *" there must be only 1 space between
the "STAR" and the "*" otherwise STARTCOM  may look like "/   *".

------- cut here -------
#define STAR *
#define STARTCOM /STAR
#define ENDCOM STAR/

STARTCOM
  Comment.c  -- by Edward Vopata (9/22/88)

  Put the text of the comment here.
  Multiple lines are allowed.
ENDCOM

main()
{
STARTCOM
  Some Comments within the main program
ENDCOM
}
------- cut here -------

The following is the ouput of the C preprocessor.

% cc -E comment.c
# 1 "comment.c"

/*
  Comment.c  -- by Edward Vopata (9/22/88)

  Put the text of the comment here.
  Multiple lines are allowed.
*/

main()
{
/*
  Some Comments within the main program
*/
}
----------
Name     : Edward Vopata            Dept. of Computing & Information Sciences
Internet : vopata at ksuvax1.cis.ksu.edu                 Kansas State University
Bitnet   : vopata at ksuvax1.BITNET                            Manhattan, Kansas
UUCP     : {pyramid,ucsd}!ncr-sd!ncrwic!ksuvax1!vopata         (913) 532-6350



More information about the Comp.lang.c mailing list