problem with optional argument
From: Christoph Arns (cha110_at_rsphysse.anu.edu.au)
Date: 05/20/04
- Next message: Martin Buchmann: "Re: Testing if a real is 'NaN'"
- Previous message: Jose L G?mez Dans: "Re: Leading zeroes in fortran binary internal write"
- Next in thread: beliavsky_at_aol.com: "Re: problem with optional argument"
- Reply: beliavsky_at_aol.com: "Re: problem with optional argument"
- Reply: Herman D. Knoble: "Re: problem with optional argument"
- Reply: jan van oosterwijk: "Re: problem with optional argument"
- Reply: Andy Vaught: "Re: problem with optional argument"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 May 2004 21:00:18 +1000
Hi all,
below is a little program snipped, which so far I always could use
successfully in a similar form. Now I got
Error: intfc_test.f90, line 36: Ambiguous specific names PF_INIT_3D and
PF_INIT_2D in generic PF_INIT
Errors in declarations, no further processing for INTFC
Error: intfc_test.f90, line 39: USE of module INTFC which has errors
Errors in declarations, no further processing for INTFC_TEST
[f95 error termination]
on an Opteron/NAG/Fedora platform:
NAGWare Fortran 95 Release 5.0
Linux rsphylc 2.6.5 #1 SMP Fri Apr 16 15:57:37 EST 2004 x86_64 x86_64
x86_64 GNU/Linux
--------------------------------------------------
module intfc
implicit none
private
public pf_init
interface pf_init
module procedure pf_init_2d
module procedure pf_init_3d
end interface
contains
subroutine pf_init_2d(nx,ny,fac,name,nph)
integer, intent(out) :: nx,ny
integer, intent(in) :: fac
character(*), intent(in) :: name
integer, intent(in), optional :: nph
nx=2
ny=4
write(*,*) trim(name)
end subroutine pf_init_2d
subroutine pf_init_3d(nx,ny,nz,fac,name,nph)
integer, intent(out) :: nx,ny,nz
integer, intent(in) :: fac
character(*), intent(in) :: name
integer, intent(in), optional :: nph
nx=2
ny=4
nz=8
write(*,*) trim(name)
end subroutine pf_init_3d
end module intfc
program intfc_test
use intfc
implicit none
integer :: nx,ny,nz, fac = 4
character(32) :: name = "hi"
call pf_init(nx,ny,fac,name)
call pf_init(nx,ny,nz,fac,name)
end program intfc_test
--------------------------------------------------
my question: is this a bug, or am I not understanding optional arguments
in combination with generic interfaces correctly?
Ta,
Christoph
- Next message: Martin Buchmann: "Re: Testing if a real is 'NaN'"
- Previous message: Jose L G?mez Dans: "Re: Leading zeroes in fortran binary internal write"
- Next in thread: beliavsky_at_aol.com: "Re: problem with optional argument"
- Reply: beliavsky_at_aol.com: "Re: problem with optional argument"
- Reply: Herman D. Knoble: "Re: problem with optional argument"
- Reply: jan van oosterwijk: "Re: problem with optional argument"
- Reply: Andy Vaught: "Re: problem with optional argument"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|