Re: How to detect NULL input?
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 20:10:39 +0000 (UTC)
Richard E Maine <nospam@xxxxxxxxxxxxx> wrote:
> 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.
OK, I was completely confused on this one. I thought that
there was now the ability to specify function return values
on the RETURN statement, but it doesn't seem that there is.
>> 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.
I don't think that is what I meant.
>> 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.
It does seem that there are complications with ENTRY, such that
array valued functions are not allowed. That is the type of
complication I was thinking of.
> 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.
Yes. I was considering complications of ENTRY and recursion,
but it seems that ENTRY forbids array value functions.
Result does allow the convenience of only one name for a return
value for a function with multiple ENTRY points.
-- glen
.
- Follow-Ups:
- Re: How to detect NULL input?
- From: Richard E Maine
- 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
- Re: How to detect NULL input?
- From: Richard E Maine
- How to detect NULL input?
- Prev by Date: Re: Fortran 77: Reading empty string
- Next by Date: Re: Kind of NOT integer constant
- Previous by thread: Re: How to detect NULL input?
- Next by thread: Re: How to detect NULL input?
- Index(es):
Relevant Pages
|
|