David Vowles wrote:
> TYPE FooType
>
> REAL :: component1
> CHARACTER (LEN = 10) :: component2
>
> END TYPE FooType
>
> TYPE(FooType) :: x
> WRITE(fout) x
>
> My question is, having written x as above, is it standard
> conforming to read x
> in component order as follows:
>
> READ(fin) x%component1,x%component2
No. Without the type being a SEQUENCE type, you don't know the order of the
fields in the internal storage representation - a compiler could choose to
put component2 first. With SEQUENCE, the order is fixed, but the standard
does not say whether or not component2 directly follows component1 in memory
- a compiler could choose to insert padding between the two components,
which might not be there if you had written the two components to the file
individually.
Steve Lionel
Compaq Fortran Engineering
http://www.compaq.com/fortran
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|