Re: How to detect NULL input?
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Tue, 31 Jan 2006 11:36:02 -0800
glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Richard E Maine <nospam@xxxxxxxxxxxxx> wrote:
> > Rich Townsend <rhdt@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> >> Fair enough. BTW, was result primarily introduced to support recursive
> > functions?
>
> > That's my impression. It was introduced in f90, before I was on J3, and
> > I don't recall ever explicitly asking, but I would assign a reasonably
> > high degree of confidence tothat guess.
>
> In the early days of Fortran, when all variables were static
> including the function return value, I could see the problem.
Huh? I don't even know what that has to do with the problem. The problem
has nothing at all to do with static vs dynamic or anything like that.
It is purely a matter of syntax. If one had, say, a recursive array
function f, then without the result clause, there would be cases where
one could not tell whether f(1) was a recursive function reference or
just a reference to the first element of the result variable for this
function.
> Is there a requirement that the function return variable be
> static in versions allowing recursion?
To my knowledge, the word "static" doesn't even appear in the language
(not that I really bothered to check). It certainly does not appear in
this regard; nor does any other word with the same implication. Rather
the opposite, I don't see an obvious way to implement recursive
functions with a static result variable. If someone can come up with
some obscure way to do so, it certainly isn't the norm. I doubt that a
single such implementation exists.
> Also, there is a tradition (in the case of ENTRY) that all function
> return variables are EQUIVALENCEd. Does it still do that, even
> in the case of recursive functions not using a function return variable?
1. Nothing in that regard is special-cased for recusrion. Yes, it still
works the same way. This seems to me unrelated to the question of why
the result clause was added.
2. *ALL* functions have a function result variable. The only thing that
th eresult clause does is give that variable a different name. But a
variable exists regardless. If you think of functions as not having
result variables, you will be lead down many wrong paths.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- Follow-Ups:
- Re: How to detect NULL input?
- From: glen herrmannsfeldt
- Re: How to detect NULL input?
- References:
- How to detect NULL input?
- From: jane . sync
- Re: How to detect NULL input?
- From: Rich Townsend
- Re: How to detect NULL input?
- From: jane . sync
- Re: How to detect NULL input?
- From: robin
- Re: How to detect NULL input?
- From: Rich Townsend
- Re: How to detect NULL input?
- From: Richard Maine
- Re: How to detect NULL input?
- From: Rich Townsend
- Re: How to detect NULL input?
- From: Richard E Maine
- Re: How to detect NULL input?
- From: glen herrmannsfeldt
- How to detect NULL input?
- Prev by Date: Re: Fortran 77: Reading empty string
- Next by Date: Re: Need clarification on unformatted IO
- Previous by thread: Re: How to detect NULL input?
- Next by thread: Re: How to detect NULL input?
- Index(es):
Relevant Pages
|
|