Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

type declaration with parameter variable does not compile

mirko_vukovic
Beginner
369 Views
Hi,

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
0 Kudos
1 Reply
Steven_L_Intel1
Employee
369 Views
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.
0 Kudos
Reply