-------------- Original message ----------------------
From: Roland Schilling <[log in to unmask]>
> Dear Fortran experts,
>
> I have the following question about the F 95 (F 2003)
> standard: Is it standard conforming to apply the LEN
> intrinsic function to a disassociated pointer to a
> character array? A corresponding code fragment would be:
I think it is. Section 13.1 in F95 says "An inquiry function
is one whose result depends on the properties of its principal
argument other than the value of the argument; in fact, the argument
value >>may be undefined.<<" And, LEN is an inquiry function.
I don't have time to look further, but I think disassociated is
one of the allowed "values" of undefined.
Dick Hendrickson
>
> character(32), pointer :: car(:)=>null()
>
> l=len(car) ! the simplest example
> ! or, more realistic:
> car=alloc_ca(car)
>
> Contains
>
> Function alloc_ca(p)
>
> character(*), pointer :: p(:)
> character(len(p)),pointer :: alloc_ca(:) ! this is the statement
> ! ...in question
> allocate(alloc_ca(4))
> return
> End Function alloc_ca
>
> end
>
> If this would not be allowed I don't know how to allocate
> 'car' by means of a function as in the above example, unless
> one also transfers the character length via the argument list
> of the function.
>
> Many thanks in advance for any help,
> Roland
>
>
> +----------------------------------------------------------------------+
> | Roland Schilling Home-Office: +49(89)32929-670 |
> | Max-Planck-Institut für Gravitationsphysik |
> | -- Albert-Einstein-Institut -- |
> | D-85748 Garching E-mail: [log in to unmask] |
> | Germany http://www.geo600.uni-hannover.de |
> +----------------------------------------------------------------------+
|