I read a Fortran code :
program t
real :: x(5) =[1.,-2.,3.,-4.,5.]
real,allocatable :: y(:)
y = x
...
For me the normal way is
allocate(y,source=x)
I'm surprised that it works, both compile with ifort or gfortran
Is there something new in the fortran standards that I'm not aware of?
allocate(y,source=x)the normal way, asy=xhas worked this way for as long as sourced allocation has existed in Fortran. One notable difference between the two ways is thatymust not be allocated for the allocate statement, but can for the assignment (not initialization).allocate. What good it will do you, damn lazy allocation ...allocate(a,b,c,source=x)instead ofa=x; b=x; c=x.