Fortran 2003 derived types have a nice feature of default initialization.
type TTest
integer :: a
integer :: b = 1
integer, pointer :: p1, p2 => null()
end type TTest
then any declared variable of type (TTest) will have initialized components b and p2 by default.
Consider the following code:
type (TTest), dimension(:), pointer :: varptr
type (TTest), dimension(:), allocatable :: varalloc
integer, parameter :: ndim = 1000
allocate( varptr(ndim))
allocate(varalloc(ndim))
Can one be guaranteed that all elements of varptr and varalloc will have initialized b and p2 members after allocation?