Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28602 Discussions

initialization of allocatble variable

pe_rasouliyahoo_com
325 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
325 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
326 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
325 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