- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
i have a problem using optional parameters in a function. i allways get the error #7836 (if the actual element is scalar, the corresponding dummy argument shall be scalar....)
the function's code is a follows:
FUNCTION get_wgprop_fn(this, wgcf, wgct, t)
IMPLICIT NONE
CLASS(tprop) :: this
REAL, DIMENSION(5) :: get_wgprop_fn
REAL, DIMENSION(4), INTENT(IN), OPTIONAL :: wgcf
REAL,DIMENSION(3), INTENT(IN), OPTIONAL :: wgct
REAL, INTENT(IN), OPTIONAL :: t
IF (PRESENT(wgcf)) THEN
get_wgprop_fn = 1
END IF
IF (PRESENT(wgct)) THEN
get_wgprop_fn = 2
END IF
IF (PRESENT(t)) THEN
wgprop_fn = wgprop_fn * 2
END IF
END FUNCTION get_wgprop_fn
calling the function from extern like
test = get_wgprop(ac) with ac as a real dimension(4) array results in no error.
but
t = get_wgprop(ac, t) with ac as defined above and t as real result in the error described a the top of this topic.
perhaps somebody sees the mistake in my code? i think, the optional-keyword says that a dummy-argments
must no be present? in the second case (get_wgprop(ac, t) the compiler searches for a dimension(3)-array what in my understanding cant be because of the optional argument???
greetings moritz
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
t = get_wgprop(ac,T=t)
- 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