- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I am trying to pass a pure function as an argument to another pure function. Is it permissible?
For example,
pure integer function func1(func2, arg2)
external func2
integer, intent(in) arg2
func1 = func2(arg2)
end function func1
pure integer function func1(arg1)
integer, intent(in) arg1
func1 = arg1*arg1
end function func1
I attempted it, but I'm getting an error that the external procedure must be declared pure. If its permissible, how to define the external function as pure.
1 Solução
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Rather than specifying func2 as an external, you should specify the exact interface:
interface
pure integer function func2( arg )
integer, intent(in) :: arg
end function func2
end interface
Otherwise the compiler has no way of knowing what the function argument is doing.
Link copiado
2 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Rather than specifying func2 as an external, you should specify the exact interface:
interface
pure integer function func2( arg )
integer, intent(in) :: arg
end function func2
end interface
Otherwise the compiler has no way of knowing what the function argument is doing.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thank you Arjen_Markus, I could make it work with your solution.

Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora