Procedure Pointers: a first patch

Tobias Burnus burnus@net-b.de
Fri May 23 21:30:00 GMT 2008


Hi Janus,

Janus Weil wrote:
> here goes another update to my procptr patch
Great.

Here are some things which do not work:

implicit none
intrinsic sin
procedure(),pointer :: foo
foo => sin
print *, sin(4.4)
print *, foo(4.4)
end

Gives the error:

Error: Symbol 'foo' at (1) has no IMPLICIT type
Error: Symbol 'sin' at (1) has no IMPLICIT type

  * * *

implicit none
intrinsic sin
real, external, pointer :: foo
foo => sin
end

gives the error:

Error: Function 'sin' requires an argument list at (1)

 * * *

implicit none
interface
  subroutine bar()
  end subroutine bar
end interface
pointer :: bar
foo => bar
end

gives the error:

Error: Unexpected use of subroutine name 'bar' at (1)

 * * *

procedure(), save, pointer :: z => null()
if(associated(z)) call z()
end

Error: PROCEDURE attribute conflicts with SAVE attribute in 'z' at (1)

 * * *
procedure(), pointer :: z => null()
if(associated(z)) call z()
end

Error: 'pointer' argument of 'associated' intrinsic at (1) must be a POINTER

  * * *

external bar
procedure(), pointer :: z => null()
z => bar
call z()
end

Dump shows that z is never initialized by zero.

Tobias



More information about the Fortran mailing list