RETURNS length
There are C library routines that return a string value, or, in
C terms, a pointer to a character array. Returning a pointer to
a static array avoids any allocation/deallocation problems, but
causes strange results if you call the routine more than once
before using the value.
PL/I has, in general, been much happier to allocate temporary
arrays than Fortran. It seems that some of the Fortran 77 CHARACTER
variable rules were designed to avoid allocating temporaries.
Otherwise, one can use CONTROLLED variables (like Fortran ALLOCATABLE),
allocate them in a called subroutine. It might be that they need to
be arguments and not a function return value, but it should work.
That way it can be allocated to the appropriate size, and deallocated
by the calling routine.
-- glen
|