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

beshers@hks.com
Thu, 24 Sep 1992 13:53:54 GMT

          From comp.compilers

Related articles
[3 earlier articles]
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)
Re: Syntax of Comments (was: language design tradeoffs) macrakis@osf.org (1992-09-25)
Re: Syntax of Comments (was: language design tradeoffs) de19@umail.umd.edu (1992-10-04)
Re: Syntax of Comments (was: language design tradeoffs) Bruce.Hoult@bbs.actrix.gen.nz (1992-10-05)
[5 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers,comp.human-factors
From: beshers@hks.com
Organization: HKS, Inc.
Date: Thu, 24 Sep 1992 13:53:54 GMT
Keywords: C, parse, syntax
References: 92-09-048 92-09-157

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).


Jim Cathey writes:
# I for one appreciate the hell out of cpp, because it allows me to maintain
# _one_ source for many slightly different environments. ...


I agree that when one *must* deal with different CPUs and OSs ifdef's work
better than comments because the changes must occur frequently. I try to
limit the use of ifdef's to this purpose in my code and use either single
line comments (reasons explained by others) for all other purposes.


# Moderator writes:
#[Many in the C++ crowd claim that "const" declarations in combination with
#in-line functions and sensible optimization of "if" statements that depend on
>onstants give you nearly everything CPP does without the aggravation of C's
#two-level syntax. -John]


Alas, this technique does not take care of structures which depend on
types defined in header files...


Finally, I would like to point out that many #ifdefs I have seen in
practice are actually required because so man parts of C were not fully
and carefully defined. Having experienced the portability implied by a
formally specified language (SML) I tend to back the use of "constants"
and "if" statements because syntactic and type correctness should always
be correct---even if the code is never used.


The use of #ifdefs for CPU and OS dependencies should be strictly limited
to a very small number of files where such things must be considered.


George Beshers
beshers@hks.com
--


Post a followup to this message

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