Re: Syntax of Comments (was: language design tradeoffs)

jimc@tau-ceti.isc-br.com (Jim Cathey)
Thu, 24 Sep 1992 00:41:56 GMT

          From comp.compilers

Related articles
language design tradeoffs kotula@milli.cs.umn.edu (1992-09-07)
Syntax of Comments (was: language design tradeoffs) crowl@jade.cs.orst.edu (1992-09-21)
Re: Syntax of Comments (was: language design tradeoffs) moss@cs.umass.edu (1992-09-23)
Re: Syntax of Comments (was: language design tradeoffs) firth@sei.cmu.edu (1992-09-23)
Re: Syntax of Comments (was: language design tradeoffs) tmb@arolla.idiap.ch (1992-09-23)
Re: Syntax of Comments (was: language design tradeoffs) jlg@cochiti.lanl.gov (1992-09-23)
Re: Syntax of Comments (was: language design tradeoffs) jimc@tau-ceti.isc-br.com (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) crowl@jade.cs.orst.edu (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) crowl@jade.cs.orst.edu (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) beshers@hks.com (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) macrakis@osf.org (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) fjh@munta.cs.mu.OZ.AU (1992-09-24)
Re: Syntax of Comments (was: language design tradeoffs) delacour@parc.xerox.com (Vincent Delacour) (1992-09-24)
[8 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers,comp.human-factors
From: jimc@tau-ceti.isc-br.com (Jim Cathey)
Organization: ISC - Bunker Ramo, Spokane, WA
Date: Thu, 24 Sep 1992 00:41:56 GMT
References: 92-09-048 92-09-144
Keywords: C, parse, syntax, comment

moss@cs.umass.edu writes:
>I second the view that ifdef is not a good idea, primarily in that C style
>macro processing, at and below the level of tokens, is even more dangerous
>and disruptive than a good comment mechanism. One can get by reasonably
>well without a C style preprocessor (as is done in Modula-3) or with
>macros that have more syntactic robustness (as in Lisp).


I for one appreciate the hell out of cpp, because it allows me to maintain
_one_ source for many slightly different environments. That is, I use the
#ifdef for what it was primarily intended for, rather than an elaborate
commenting mechanism. Occasionally I'll use #if 0 to temporarily (and
quickly) disable some chunk of code, or else #ifdef GOODBYE_FEATURE if
it's a semi-permanent removal.


Cases in point: A graphics package that runs on two different CPU's, and
there are two models of one of them. On one model of the main CPU the
code does half the work, and sends a message to the server on the
coprocessor CPU to do the rest (the actual rendering). On the other
model, one CPU has to do it all. The code is more-or-less the same in all
places, so far as the work to be done goes. A few #ifdefs sprinkled
around and it is tractable.


If this sort of preprocessor mechanism were not already present in C I
would have had to write one anyway (or use m4?), or face a maintenence
nightmare. I submit that cpp's presence is one of the reasons that C is
so strong in the industry. It's a tool that wears well, though, like any
tool, it can be abused.
--
Jim Cathey, ISC-Bunker Ramo, TAF-C8; Spokane, WA 99220
UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com) (509) 927-5757
[Many in the C++ crowd claim that "const" declarations in combination with
in-line functions and sensible optimization of "if" statements that depend on
constants give you nearly everything CPP does without the aggravation of C's
two-level syntax. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.