Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Pointers to der...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 8186 of 8775
Post > Topic >>

Pointers to derived type objects in COMMON

by Walter Spector <w6ws_xthisoutx@[EMAIL PROTECTED] > Apr 27, 2008 at 06:48 AM

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 do***ented 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.
 




 5 Posts in Topic:
Pointers to derived type objects in COMMON
Walter Spector <w6ws_x  2008-04-27 06:48:16 
Re: Pointers to derived type objects in COMMON
Tobias Burnus <burnus@  2008-04-27 09:00:53 
Re: Pointers to derived type objects in COMMON
Walter Spector <w6ws_x  2008-04-27 11:42:19 
Re: Pointers to derived type objects in COMMON
nospam@[EMAIL PROTECTED]   2008-04-28 20:29:57 
Re: Pointers to derived type objects in COMMON
Walter Spector <w6ws_x  2008-04-30 14:36:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 3:27:56 CDT 2008.