|Optimizers and correct code email@example.com (Dale Worley) (1988-07-08)|
|Date:||Fri, 8 Jul 88 09:32:12 EDT|
|From:||Dale Worley <firstname.lastname@example.org>|
I was very pleased to read Phil Pfeiffer's second message. It is
surprisingly common to hear from dweebs who think "it works on my
compiler, therefore it is valid C" -- just read comp.lang.c.
A few notes: You should get a copy of the ANSI C proposal. It may not
be wonderful, but it tries to clean up a lot of things that K+R never
really defined formally. For instance, there is a systematic varargs
facility. You should also note that in ANSI C, a pointer into an
array can be incremented so that it points to "the element after the
last element of the array". (This is in deference to 10 billion for's
that generate this pointer and then test it.) But you may not use
this pointer to read memory.
However, a pointer cannot be decremented to point to the element
before the first element of the array.
Steve Benz points out the difficulty of having the compiler/run time
code enforce many of these restrictions. If you're interested in
seeing what it takes, look at the manuals for IBM's PL/1 checkout
compiler, which exhaustively enforces all the language rules.
If you're interested in using parallelism during compiling, there is
an article the SIGPLAN 88 Conference on Programming Language Design
and Implementation: "Semantic Analysis in a Concurrent Compiler" that
has a lot of references into the literature. Although it differs from
the previous discussions in that it assumes that the number of
processors is less than the number of tokens in the program.
[From Dale Worley <email@example.com>]
Return to the
Search the comp.compilers archives again.