Re: Pointers to functions: Is this the right [f03] syntax?



Andy <andyv@xxxxxxxxxxxxxx> wrote:

Richard E Maine wrote:
Andy <andyv@xxxxxxxxxxxxxx> wrote:

I've made a couple fixes and the current g95 can compile and run this
code fine now. I am worried that things may be a little too loose in
that the pointer p in the original code points to a subroutine, then
later on a function,

I don't see that in the code posted here, though I suppose it might be
so in the prior posting to gg95 (I don't often read that group).

It looked something like:

[elided code that looks just as Andy described]

I think I'll let someone else comment on the legality of that. I'm not
sure. I would probably argue that it is invalid. I know that you can
have a pointer that can point to either a function or a subroutine, but
I think I'd argue that once you establish that it is one or the other in
a specific scope, that fact "sticks". After all - you for sure can't
have it be a function returning two different types in two different
references in the same scope; there's just no way to declare such a
dynamic change. Referencing the pointer as a function or subroutine
ought to establish adequately.

But then I seem to recall making an argument somewhat along those lines
and having it rebutted in the J3 list. It probably wasn't this exact
case, but something close enough that I'm more than normally reluctant
to push my interpretation as accurate.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.