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.
29285 Discussions

initialization of allocatble variable

pe_rasouliyahoo_com
596 Views

my previous question regarding initialization of local variables had been answerd... does anybody knows how to initialization of allocatble variables in the compiler?

0 Kudos
1 Solution
Steven_L_Intel1
Employee
596 Views
There is none. You must do it yourself. The /Qzero option is there only to help with "dusty deck" programs that assumed static, zero allocation for local variables.

Please do not look for compiler switches to make up for errors in programming.

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
597 Views
There is none. You must do it yourself. The /Qzero option is there only to help with "dusty deck" programs that assumed static, zero allocation for local variables.

Please do not look for compiler switches to make up for errors in programming.
0 Kudos
lklawrie
Beginner
596 Views

If you're allocating within a derived type, you can set initializations there.

TYPE SurfaceData

CHARACTER(len=MaxNameLength) :: Name = ' ' ! User supplied name of the surface (must be unique)
INTEGER :: Construction = 0 ! Pointer to the construction in the Construct derived type
INTEGER :: Class =0

End Type SurfaceData

TYPE (SurfaceData), ALLOCATABLE, DIMENSION(:) :: Surface

When you allocate Surface, e.g. Allocate(Surface(20)) each element is initialized.

Linda

0 Kudos
Reply