>
> There seems to be a restriction that the result of an array-valued
> function must be an explicit-shape array or a pointer. Given that
> restriction, how would one write a function with behavior similar to
> the F90 PACK intrinsic? In many functions, the shape of the result is
> related to the shape(s) of the argument(s). The case of PACK is an
> exception - the shape of the result cannot be declared as a function
> of the arguments.
>
This is precisely why pointer results are permitted. You work out
how large the array needs to be, allocate it, and then assign its
values.
John Reid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|