spectrum
unread,Feb 22, 2021, 12:48:34 PM2/22/21You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I am not familiar with class(*), but isn't the "allocate-on-assignment" version
possibly useful for copying two objects having components of class(*) inside?
For example,
type Mydata_t
class(*), allocatable :: data
integer :: n
!! ... other stuff ...
endtype
type(Mydata_t) :: a, b
!! ... b is assumed to be initialized somewhere ...
a = b !! each components are assigned with auto (re)allocation
But I experienced some issue for this kind of "class assignment" some time ago
(so I rewrote the code with "type assignment" only, which had no problem at that time),
so I guess allocate() might be more stable, e.g. for old compiler versions.