From: | wclodius@los-alamos.net (William Clodius) |
Newsgroups: | comp.compilers |
Date: | Tue, 15 Mar 2011 19:51:35 -0600 |
Organization: | Compilers Central |
References: | 11-03-032 11-03-040 |
Keywords: | design, optimize |
Posted-Date: | 15 Mar 2011 21:49:49 EDT |
noitalmost <noitalmost@cox.net> wrote:
> <snip>
>
> I did a little looking at some of the languages that offer PURE. Ada
> and PL/I seem to be like programmer promises to the compiler that the
> function is pure. Are Fortran and the gcc extension the same way? Or
> do they offer compiler checks, like as happens for const in gcc C++?
In essence they are programmer promises, that in some circumstances
cannot be verified by the compiler. For Fortran for example if you call
C code or old style Fortran subprograms, the compiler will assume that
you aren't lieing to it. However if you use the preferred modern stlyle
and only invoke subprograms written in that style, so that all
interfaces are explicit, you make it possible for the compiler to detect
failure for the procedure to be "PURE", and other inconsistencies in
your API. In principle it could also tell you that it is unable to
verify the consistency of the API, although I don't know of any
compilers that do so.
--
Bill Clodius
Return to the
comp.compilers page.
Search the
comp.compilers archives again.