defining a comment?
will summers
will.summers at p6.f18.n114.z1.fidonet.org
Sat Sep 24 10:42:42 AEST 1988
In article <678 at ksuvax1.cis.ksu.edu> vopata at ksuvax1.cis.ksu.edu (Ed Vopata)
writes:
> In article <855 at vsi.UUCP> friedl at vsi.UUCP (Stephen J. Friedl) writes:
> 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. ... 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
Interesting... Will it always work under dpANS? (I doubt it). Even
though the code will look like
/*
< comments >
*/
after translation phase 4, subsequent translation phases need not interpret
this as a comment: they expect comments to have been stripped. (2.1.1.2)
On second thought "need not" may not be strong enough: perhaps it should
be "subsequent translation phases **may not** interpret
this as a comment". Since STARTCOM..ENDCOM will generate code with
syntax errors, a conforming implementation -must- issue a diagnostic
message. (2.1.1.3)
As long as a "preprocess only" option is available, however,
running the code through -twice- would seem to work under dpANS... But
then a simpler pre-compile pass can map STARTCOM to /* if desired.
dpANS aside, STARTCOM..ENDCOM seems non-portable unless the order of
macro-expansion/comment-striping is specified somewhere pre-ANSI. It does
not seem to have been specified in K&Rv1.
\/\/ill
--
St. Joseph's Hospital/Medical Center - Usenet <=> FidoNet Gateway
Uucp: ...{gatech,ames,rutgers}!ncar!noao!asuvax!stjhmc!18.6!will.summers
More information about the Comp.lang.c
mailing list