language lawyer question

Paul Thomas paulthomas2@wanadoo.fr
Sat Jan 22 06:24:00 GMT 2005


Martin,

If it helps you develop some code that you are doing, there is a workaround:

program test
   use simpleObj
   use derivedObj
   implicit none
   type(objA),target :: oa
   type(objA),pointer :: ot    ! repository for getOa result
   type(objB),target :: ob
   call new(oa,1)
   call new(ob,oa,2)
   call print(ob)
   ot=>getOa(ob)                 ! obtain the objA pointer
   call print(ot)                    ! print it
end program test

Apparently, the temporary formed in "print(getOa(ob))" gets trashed somehow.

Paul T 




More information about the Fortran mailing list