Re: Proper way to return a string



Walter Spector <w6ws_xthisoutx@xxxxxxxxxxxxx> wrote:

Richard Maine wrote:

an internal function with a len=*
result would be at least ... strange....
Hmm. I can't see how the calling routine could declare the length of a
char(len=*) internal function. That would be two different declarations
in the same scope. That probably effectively disallows them...

Yup.

Likewise is creating an INTERFACE block for such a routine legal?

The g95, gfortran, and Salford compilers compile it without complaint.
However IRIX f90 gives a big warning - basically saying the routine
would be uncallable. And Intel considers it a fatal error.

I recall this question comming up in an interp (or perhaps just
discussion). I'm having trouble recalling what the final answer was. At
one time I recall an answer much like what you report the IRIX compiler
as saying - that you could have such a function, but you couldn't
reference it. But I'm not sure that was the final answer. At least some
people objected to that as being, perhaps pedantically consistant, but
unhelpful; they might have ended up swaying a majority.

Without going to the trouble of researching it more, I suspect that the
wording you cite from f95 might have been the result of that discussion
(implying that the discussion must have been about f90). It would seem
to make the cases in question illegal even if you don't reference the
function, presumably on the logic that a non-referenceable function is
pointless and probably not intended, so it is more helpful to disallow
it than to leave the presumed bug for later detection. If such a
function may not have an explicit interface, then that prohibits it from
being an internal or module function, and also prohibits writing an
interface body for such a function.

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



Relevant Pages

  • Re: Iterators redux
    ... but you can't prove the correctness via DbC without ... Okay, but those side effects would have to be documented. ... > to remove the redundancy and add a single routine which does both. ... I declare variables in the middle even in 3-line functions. ...
    (comp.object)
  • Re: Static and Global Variables
    ... the variables to JUST that routine, ... of course when you use the static key word to declare the variable. ... the pop-up form (frmAdd). ... Response As Integer) ...
    (microsoft.public.access.modulesdaovba)
  • Re: Static and Global Variables
    ... the variables to JUST that routine, ... of course when you use the static key word to declare the variable. ... the pop-up form (frmAdd). ... Response As Integer) ...
    (microsoft.public.access.modulesdaovba)
  • Re: Lexus Landcruiser 100s Are Vulnerable to CellPhone Viruses
    ... > Based on the media coverage so far, it looks like Kaspersky Labs will ... > we can expect Al Qaeda to use RC devices to drive cars into skyscrapers. ... > Lexus will perhaps issue a recall to tighten up the mobile device. ... That is not to say that they are infrequent, but hardly routine. ...
    (microsoft.public.security.virus)
  • Re: Function declarations - why are they needed?
    ... >> For example in Python functions are defined once and never declared ... The same holds in Fortran where you need not declare ... Fortran is typically used for large MLOC programs and there is *no* ... else) which require the called routine to have an 'explicit interface' ...
    (comp.lang.c)