- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi,
In my references I could not find the reason why this snippet fails to compile:
If I move the real,parameter out of the type statement, the program compiles. What am I missing?
Thanks,
Mirko
In my references I could not find the reason why this snippet fails to compile:
PROGRAM param_decl
type harmonic_efield
real,dimension(3)::E
real ::f=13.56e6,phase=0.
integer file_unit
real,parameter::twopi=6.28318530718
end type harmonic_efield
END PROGRAM param_decl
If I move the real,parameter out of the type statement, the program compiles. What am I missing?
Thanks,
Mirko
- Balises:
- Intel® Fortran Compiler
Lien copié
1 Répondre
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
This is not allowed in Fortran. In the declaration of a derived type, the only "component-attr-spec" attributes allowed are POINTER and DIMENSION. (ALLOCATABLE is allowed as an extension to F95.)
A PARAMETER is not a variable - it is a "named constant" and does not belong inside a TYPE declaration.
DEC Fortran (and its derivatives) does allow the PARAMETER statement (but not attribute) within a STRUCTURE declaration, but STRUCTURE is non-standard.
A PARAMETER is not a variable - it is a "named constant" and does not belong inside a TYPE declaration.
DEC Fortran (and its derivatives) does allow the PARAMETER statement (but not attribute) within a STRUCTURE declaration, but STRUCTURE is non-standard.
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable