Re: Fortran PURE routines, was In a Pascal-like language,

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Thu, 24 Mar 2011 17:51:25 +0000 (UTC)

          From comp.compilers

Related articles
In a Pascal-like language, would being able to declare a subroutine as noitalmost@cox.net (noitalmost) (2011-03-11)
Re: In a Pascal-like language, would being able to declare a subroutin noitalmost@cox.net (noitalmost) (2011-03-15)
Re: In a Pascal-like language, would being able to declare a subroutin mcr@wildcard.demon.co.uk (Martin Rodgers) (2011-03-16)
Re: In a Pascal-like language, would being able to declare a subroutin sinu.nayak2001@gmail.com (Srinivas Nayak) (2011-03-16)
Re: In a Pascal-like language, would being able to declare a subroutin gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-19)
Re: In a Pascal-like language, would being able to declare a subroutin sinu.nayak2001@gmail.com (Srinivas Nayak) (2011-03-21)
Re: Fortran PURE routines, was In a Pascal-like language, gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-24)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Thu, 24 Mar 2011 17:51:25 +0000 (UTC)
Organization: A noiseless patient Spider
References: 11-03-032 11-03-040 11-03-043 11-03-044 11-03-047 11-03-052
Keywords: optimize, design, Fortran
Posted-Date: 27 Mar 2011 01:38:29 EDT

Srinivas Nayak <sinu.nayak2001@gmail.com> wrote:
(previous snip regarding PURE functions)


> You are correct...The similar thing is found in C++; static functions
> can use only static variables. But however strict a compiler may be,
> there is always a loop hole. Pointer is one biggest threat.


That is why it is easier to keep PURE in Fortran. People were writing
in Fortran almost 40 years before POINTER was available, and even then
it isn't as big a loophole as in C.


(Not counting CRAY pointers, which weren't part of the language,
though were used anyway.)


Fortran with call-by-reference (or call-by-value-result) normally
doesn't give one access to the pointer to modify, as C does. Fortran
POINTER variables are also restricted much more than in C. For real
protection, bounds checking has to be done, and most systems don't, or
don't by default.


-- glen



Post a followup to this message

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