Re: Unexpected assignment statement in module?



Erik Toussaint <user@xxxxxxxxxxxxxxxxxxx> wrote:
On 30-4-2011 20:22, glen herrmannsfeldt wrote:
It was recently explained in this group that a Fortran 2008 feature
allows one to dimension a rank one array from the initialization:

real(p) :: c(*) = [1.2, 3.4, 5.6, 7.8]

It would seem that if reshape was needed, this couldn't work in 2D.

If I read the standard correct, you can use this syntax for any desired
rank:

real(p) :: ck_a(*,*) = reshape( [ ... ], [ 6, 6 ] )

Well, you still have to put in both dimensions, though into the
reshape instead. In C, this sometimes comes from initializations
that are conditional on preprocessor symbols, such that the actual
number is determined at compile time. (There is an additional C
rule that allows for a trailing comma.)

The unix I/O system is based on an array of structures, each
representing a different type of device. Sysgen compiles a routine
containing this array, one reason unix used to require a C compiler.

-- glen

.