Does assignment count as uninitialised access?
Terry Frankcombe
terry@chem.gu.se
Fri Jun 8 20:41:00 GMT 2007
Hi folks
On this list, lots of code snippets are declared invalid due to
uninitialised access. It makes me curious what the standard has to say
about this. Does copying count, if the copy is not subsequently
accessed? Consider the following:
program fred
implicit none
real,dimension(4)::a,b
a(1)=1
a(2)=2
b=a
write(*,*)b(1:2)
end
>From the point of view of interpreting what's stored in a memory
location, whatever junk that is initially to be found in a(3:4) is never
referenced. I'd view this as being in the spirit of "no uninitialised
access", and indeed compiling and running this program performs as
expected. If it's in the spirit, is it in the letter of the law?
Ciao
Terry
More information about the Fortran
mailing list