Newsgroups: | comp.compilers,comp.human-factors |
From: | crowl@jade.cs.orst.edu (Lawrence Crowl) |
Organization: | Oregon State University, Corvallis Oregon |
Date: | Thu, 24 Sep 1992 06:21:56 GMT |
References: | 92-09-048 92-09-157 |
Keywords: | C, parse, syntax |
the 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
>constants give you nearly everything CPP does without the aggravation of C's
>two-level syntax. -John]
The "constant if condition" approach has two problems.
First, consider the "Whatzit" system. It has a "foobar" routine that I've
got to call to get my program to work. No other system has the "foobar"
routine, so if the parser routinely type checks the code, the compilation
will fail on every other system. We can get around this by doing constant
evaluation of conditions before type checking the body. Unfortunately,
this delays the recognition of errors.
Second, the body must be syntactically correct in order to parse
successfully. For most code, this shouldn't be a problem. Unfortunately,
there are some syntactic differences that will arise in systems. The
"shared" storage class of Sequent C comes to mind.
I don't like the C preprocessor for many reasons. However, it does
provide a cheap work-around to many problems dealing with real systems.
Viable alternatives always seem to imply configuration management systems,
language support for generics, etc.
--
Lawrence Crowl 503-737-2554 Computer Science Department
crowl@cs.orst.edu Oregon State University
...!hplabs!hp-pcd!orstcs!crowl Corvallis, Oregon, 97331-3202
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.