- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The following call produces the warning:
...no actual arg corresponding to dummy arg N...
any ideas?
call stopit('Hello')
...
subroutine Stopit(msg,n)
integer,optional ,intent(in):: n
character(111),intent(in):: msg
...no actual arg corresponding to dummy arg N...
any ideas?
call stopit('Hello')
...
subroutine Stopit(msg,n)
integer,optional ,intent(in):: n
character(111),intent(in):: msg
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
8 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
You need an explicit interface to call a routine with an optional argument.
Steve
Steve
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Try adding a comma immediately after 'Hello'.
James
James
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
But Steve, I have been happily using optional arguments without explicit interfaces by putting the subroutines with optional arguments into a module. I learnt this from you, after studying your very useful FortranWinPrint, which does not use an explicit interface.
Well, I was happy until recently when I have consistently been getting a warning message on compiling, which I have reduced to the simplistic case below:
Warning: In the call to UTILS_mp_CALLED, actual argument #4 has no corresponding dummy argument.
10 call Called(*10,'F')
Firstly there are only 3 arguments, and secondly it looks legal code to me. It does also link and run without any errors that I have been able to detect. I am using CVF6.6A, W2K SP3. Is it possible to get rid of this spurious warning?
Alan
Well, I was happy until recently when I have consistently been getting a warning message on compiling, which I have reduced to the simplistic case below:
Warning: In the call to UTILS_mp_CALLED, actual argument #4 has no corresponding dummy argument.
10 call Called(*10,'F')
Firstly there are only 3 arguments, and secondly it looks legal code to me. It does also link and run without any errors that I have been able to detect. I am using CVF6.6A, W2K SP3. Is it possible to get rid of this spurious warning?
MODULE UTILS Contains ! subroutine Calling 10 call Called(*10,'F') return end subroutine Calling ! subroutine Called( *, FileorDir, Quiet) ! * Return 1 on error ! character*1, intent(in), optional :: FileOrDir logical*1, intent(in), optional :: Quiet return end subroutine Called ! end module UTILS
Alan
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Alan,
You are using an explicit interface - it's in the module. Your case is a bug - the alternate return (yuck!) is throwing off the compiler's argument checker. BTW, it says argument #4 because CHARACTER arguments count as two. Confusing, I know. We should really clean this up someday...
Steve
You are using an explicit interface - it's in the module. Your case is a bug - the alternate return (yuck!) is throwing off the compiler's argument checker. BTW, it says argument #4 because CHARACTER arguments count as two. Confusing, I know. We should really clean this up someday...
Steve
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Steve,
Thanks for that - but I have not found any reference in the User's Guide or the Language Reference Manual to the fact that putting subroutines with optional arguments into modules produces explicit interfaces. I suspect that I am not alone here.
I am also trying to find similar guidance for dynamically declaring arrays in subroutines - I know that the following works for arrays B & C, but again I can find nor reference (perhaps I am not very good at ferreting these things out).
Alan
Thanks for that - but I have not found any reference in the User's Guide or the Language Reference Manual to the fact that putting subroutines with optional arguments into modules produces explicit interfaces. I suspect that I am not alone here.
I am also trying to find similar guidance for dynamically declaring arrays in subroutines - I know that the following works for arrays B & C, but again I can find nor reference (perhaps I am not very good at ferreting these things out).
Subroutine ABCD(A,N) Integer*4, intent(in) :: N Real*8, intent(in) :: A(N) Real*8 B(N), C(N) return end
Alan
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Alan,
See my article on the topic of explicit interfaces in the Visual Fortran newsletter. The Language Reference Manual isn't intended to teach the Fortran language, and the nuances of explicit interfaces are more a matter for a tutorial.
For your array question, see the LRM index under "Automatic arrays".
Steve
See my article on the topic of explicit interfaces in the Visual Fortran newsletter. The Language Reference Manual isn't intended to teach the Fortran language, and the nuances of explicit interfaces are more a matter for a tutorial.
For your array question, see the LRM index under "Automatic arrays".
Steve
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Steve,
Thanks for the references ? but I still maintain that something as important as modules providing explicit interfaces should be in the LRM. On dynamic sizing of arrays, I will add ?Automatic? to my list of words that mean something different in Fortran: the prime example is ?Parameter?.
You don?t seem to like alternate returns, which I use when it is even less elegant not to use them, but the Fortran File I/O intrinsic statements are effectively full of them in the form of eg ERR=label, END=label, etc. But I have not heard of their being deprecated!
Alan
Thanks for the references ? but I still maintain that something as important as modules providing explicit interfaces should be in the LRM. On dynamic sizing of arrays, I will add ?Automatic? to my list of words that mean something different in Fortran: the prime example is ?Parameter?.
You don?t seem to like alternate returns, which I use when it is even less elegant not to use them, but the Fortran File I/O intrinsic statements are effectively full of them in the form of eg ERR=label, END=label, etc. But I have not heard of their being deprecated!
Alan
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I'll suggest to our writers that they enhance the section of the manual discussing explicit interfaces.
Steve
Steve

Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla