Print

Print


Peter,

At 15:33 04-05-2000 +0200, you wrote:
>Dear Jan,
>
>Thank you very much for your help.
>
> > In this case an explicit interface is needed.
> > And I think that You must use assumed shape .
> > I append the programme as it works correctly.
> > Hope this helps.
>
>The program you sent compiled and run correctly.
>However, the solution was even simplier: instead of
>        REAL, INTENT(IN) :: x(*)
>I should have typed
>        REAL, INTENT(IN) :: x(:)
>
>The x(:) tells the compiler to pass the length information, hidden from the
>user. It is equivalent to
             ^^^^^^^^^^    more or less equivalent
  IF the interface is explicit.

>FUNCTION text(x, n)
>  INTEGER:: n
>  REAL, INTENT (IN):: x(1:n)
>
>The use of the star descriptor, x(*), is to tell the compiler that it *does
>not
>know* what the upper bound is. My Fortran 77 manual referred to this as 'the
>compiler assumes that the upper bound is infinite.'
>
>So my real problem remains absolutely unsolved: how do you know how many
>elements an assumed-size array has? I do not want to pass the dimension by
>the calling program.

This is not possible.  Use assumed shape indeed.
And - to be standard conforming - use an explicit interface in the calling
program.
Otherwise the shape information is NOT transmitted.
I tried two compilers.
One gives  0 (zero), the other 4189523 as result  :-)  ..

>If you know a solution to that, I would be very happy to hear about it.
>Best regards, 
>Peter de Haan


---
Meilleures Salutations,
Best Greetings,
/---
Jan van Oosterwijk
Computing Centre
Delft University of Technology
Postbus    354
2600 AJ  Delft
Netherlands / Pays-Bas
Phone: +31 15 278 50 17
Fax:   +31 15 278 37 87




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%