- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I'm trying to use features of fortran 2003.
Problem is procedure bound to type.
I'm want my method "init" have couple of implementions
So I've tried to use "GENERIC" statement.
file_handler_module.f90(24): error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
generic :: init=> init_d,init_e
------------------------^
file_handler_module.f90(24): error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(24): error #6973: This is not a valid initialization expression. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(50): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [INIT_D]
subroutine init_d(f,name_prefix)
-------------------^
file_handler_module.f90(24): error #6404: This name does not have a type, and must have an explicit type. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
compilation aborted for file_handler_module.f90 (code 1)
code
is generic statement is supported?
Is there some other wayto do it?
Problem is procedure bound to type.
I'm want my method "init" have couple of implementions
So I've tried to use "GENERIC" statement.
file_handler_module.f90(24): error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
generic :: init=> init_d,init_e
------------------------^
file_handler_module.f90(24): error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(24): error #6973: This is not a valid initialization expression. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
file_handler_module.f90(50): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [INIT_D]
subroutine init_d(f,name_prefix)
-------------------^
file_handler_module.f90(24): error #6404: This name does not have a type, and must have an explicit type. [INIT_D]
generic :: init=> init_d,init_e
----------------------------------^
compilation aborted for file_handler_module.f90 (code 1)
code
[bash]module file_handler_module IMPLICIT NONE type cfile_handler private character*55 ::file_name integer::file_handle contains ! procedure :: init procedure :: handle procedure :: name generic :: init=> init_d,init_e end type cfile_handler private current_handle integer::current_handle=1000! contains subroutine init_d(f,name_prefix) class (cfile_handler)::f character*25 ,intent(in) ::name_prefix end subroutine init_d subroutine init_e(f,name_prefix,name_ext) class (cfile_handler)::f character*25 ,intent(in) ::name_prefix character*25 ,intent(in) ::name_ext end subroutine init_e integer function handle(f) class (cfile_handler)::f handle=f%file_handle end function handle character*55 function name(f) class (cfile_handler)::f name=f%file_name end function name end module file_handler_module [/bash]Question: what's wrong?
is generic statement is supported?
Is there some other wayto do it?
- Marcas:
- Intel® Fortran Compiler
1 Solução
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
In the latest Release Notes there's a note for it:
Note: GENERIC attribute, FINAL procedures and type-bound operators are not supported in this release
mecej4 is right about the required specific binding. gfortran (v4.5) complains about it:
Error: Undefined specific binding 'init_e' as target of GENERIC 'init' at (1)
Link copiado
5 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I believe that you need to declare init_d and init_e as type-bound procedures before defining the generic name init on line-14.
Be that as it may, I don't think that the Intel Fortran compiler supports generic type-bound procedures yet (this statement is a candidate for correction if the Intel people comment on it).
Be that as it may, I don't think that the Intel Fortran compiler supports generic type-bound procedures yet (this statement is a candidate for correction if the Intel people comment on it).
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
In the latest Release Notes there's a note for it:
Note: GENERIC attribute, FINAL procedures and type-bound operators are not supported in this release
mecej4 is right about the required specific binding. gfortran (v4.5) complains about it:
Error: Undefined specific binding 'init_e' as target of GENERIC 'init' at (1)
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks You Guys!
Now it's all clear. I hope generic statement will be included soon.
Now it's all clear. I hope generic statement will be included soon.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Yes, it will be in a release later this year.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Great news! I'm loooking forward to it.

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