Re: Proper way to return a string
- From: Walter Spector <w6ws_xthisoutx@xxxxxxxxxxxxx>
- Date: Sat, 30 Dec 2006 17:26:12 GMT
Richard Maine wrote:
...
Error: Internal function 'str_func' at (1) cannot be an assumed-length
CHARACTER
I'm too tired to check right now, but an internal function with a len=*
result would be at least ... strange. Might be disallowed...
In F95 §12.3.1.1(2)(e) addresses this case. It prohibits a character function
with an assumed length result from having an explicit interface.
Interestingly it also says the same about 'non-constant length results'.
This seems like a bug in the Standard.
In F2003 §12.3.1.1 the sentence above has been reworded to cover
'nonassumed type parameter value that is not an initialization
expression' - which seems much more reasonable.
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?
module bel2
implicit none
interface
function str_junk (a)
implicit none
character(*), intent(in) :: a
character(*) :: str_junk
end function
end interface
end module
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.
Walt
.
- Follow-Ups:
- Re: Proper way to return a string
- From: Steven G. Kargl
- Re: Proper way to return a string
- From: Richard Maine
- Re: Proper way to return a string
- References:
- Proper way to return a string
- From: Jeremy
- Re: Proper way to return a string
- From: Steven G. Kargl
- Re: Proper way to return a string
- From: Gordon Sande
- Re: Proper way to return a string
- From: Ron Shepard
- Re: Proper way to return a string
- From: Beliavsky
- Re: Proper way to return a string
- From: Richard Maine
- Proper way to return a string
- Prev by Date: Re: Proper way to return a string
- Next by Date: Re: Proper way to return a string
- Previous by thread: Re: Proper way to return a string
- Next by thread: Re: Proper way to return a string
- Index(es):
Relevant Pages
|