Pointers to derived type objects in COMMON
- From: Walter Spector <w6ws_xthisoutx@xxxxxxxxxxxxx>
- Date: Sun, 27 Apr 2008 06:48:16 -0700
Fellow clfers,
Consider the following:
subroutine commonptr ()
implicit none
type wws_t ! No SEQUENCE and has default initialization
integer :: x = 1, y = 2, z = 3
end type
type (wws_t), pointer :: my_wwsptr
common /block/ my_wwsptr
allocate (my_wwsptr)
my_wwsptr = wws_t (3, 4, 5)
end subroutine
We all know that for a derived type object to reside in COMMON, it
must have a SEQUENCE attribue, and must not have default initialization
specified. These are documented in constraint C589 in §5.5.2 of F2003:
"C589 (R558) If a common-block-object is of a derived type, it shall be
a sequence type or a type with the BIND attribute and it shall have no
default inititialization."
But what about *pointers* to the objects? If I merely want to place
a pointer to the object in the COMMON block, my reading of §5.5.2
says that it is legal to allow the pointer regardless. PGI and
Salford/Silverfrost allow the above code. However ifort, gfortran,
g95, IRIX f90, and others do not allow it.
Opinions?
W.
.
- Follow-Ups:
- Re: Pointers to derived type objects in COMMON
- From: Tobias Burnus
- Re: Pointers to derived type objects in COMMON
- Prev by Date: Re: Are f.p. manipulation functions only used in initialization?
- Next by Date: Re: Using external subroutines in OpenMP?
- Previous by thread: Programming Discussion Forum
- Next by thread: Re: Pointers to derived type objects in COMMON
- Index(es):
Relevant Pages
|
|