Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!ncar!noao!asuvax!stjhmc!p6.f18.n114.z1.fidonet.org!will.summers From: will.summers@p6.f18.n114.z1.fidonet.org (will summers) Newsgroups: comp.lang.c Subject: Re: defining a comment? Message-ID: <728.233D2FBF@stjhmc.fidonet.org> Date: 24 Sep 88 00:42:42 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.24) Organization: FidoNet node 1:114/18.6 - Iasd Eng Bbs, Phoenix Az Lines: 56 In article <678@ksuvax1.cis.ksu.edu> vopata@ksuvax1.cis.ksu.edu (Ed Vopata) writes: > In article <855@vsi.UUCP> friedl@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