C common practice. (what it really is)

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Apr 30 01:21:53 AEST 1991


In article <TMB.91Apr29014917 at volterra.ai.mit.edu> tmb at ai.mit.edu (Thomas M. Breuel) writes:
> Likewise, a compiler
> can only determine that a function is side-effect free if the
> source code to that function is available at compile time.

Yeah. What Jim's really trying to say (but doing a nauseatingly bad job
of saying) is that such information should be part of the procedure-call
interface. If you declare a function ``pure'' (some compilers allow
this), then the function is not allowed to use global variables or call
impure functions, but any caller can assume that the function will
return the same value for the same inputs. Similarly, if you declare a
function with ``arguments 1 and 2 aren't aliased'', then any caller must
make sure that this is true, but the optimizer will have an easier time
on vector machines.

The interesting issues here are what sort of assertions to allow, how
much the compiler should check, etc. A number of experimental languages
have addressed these issues, more or less successfully.

I think Jim's ignorance of the C standard, C common practice, and
available C compilers has been quite thoroughly demonstrated in this
thread, and I hope my comments here make clear that Jim really isn't
thinking about C at all. So can we stop discussing this in comp.lang.c?

---Dan



More information about the Comp.lang.c mailing list