Re: Proper way to return a string



Beliavsky <beliavsky@xxxxxxx> wrote:

I don't think a function have a character(len=*) RESULT

Yes, it can. It just doesn't mean what you would think. It means that
the length is declared in the calling program - *NOT* determined by
anything in the function. This feature is obsolescent. I'd say that at
least 90% of the people who try to use it don't understand what it does.
(Our beloved writer of non-working TRIM functions probably does
understand, but intentionally trolls; and gets far too many bites from
people who should just kill-file him.)

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. Or I could
well imagine compilers having trouble with it if it were allowed. But
this is specific to internal functions - not external or module ones.

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 even if
there isn't an explicit prohibition. You are required to declare the
length (and as something other than *) in the calling scope. So if you
can't do that in some context, you can't have such a function there.

--
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: Variable scope mystery
    ... inside nested function even while you are calling it in. ... so I declare it having a global scope. ... > can't be accessed within blahblah(). ... > global $foo; ...
    (comp.lang.php)
  • Re: Kick Starting AfterUpdate Event in another Form
    ... Pete, if you want to call a procedure or function within a form module from ... it is best to declare that procedure in a module on the Modules ... If it needs to know values from the calling form, ... > having the Event Procedure and this how I have called up ...
    (microsoft.public.access.formscoding)
  • Re: Unnecesary Library Call ?
    ... | James J. Weinkam wrote: ... | This is an internal function subroutine with the BITfield passed ... | don't declare this explicitly. ...
    (comp.lang.pl1)
  • Re: DllImport into C#
    ... > I'm still very stumped about why i get an exception when i don't debug the ... >> It seems that the DllImport's default char set is ANSI so StringBuilder ... >> as CDECL and I had to specify the calling convention in the DllImport ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DllImport into C#
    ... > I'm still very stumped about why i get an exception when i don't debug the ... >> It seems that the DllImport's default char set is ANSI so StringBuilder ... >> as CDECL and I had to specify the calling convention in the DllImport ...
    (microsoft.public.dotnet.framework.interop)