A little pointer on POINTER in data would be helpful

Tim Zeisloft tim@marlettesoftware.com
Sat Mar 24 23:42:00 GMT 2018


On 3/24/2018 4:29 PM, Steve Kargl wrote:
> On Sat, Mar 24, 2018 at 04:06:40PM -0700, Steve Kargl wrote:
>>> All specifications
>>> containing initial-data-target always show it to the right of "=>", not
>>> "=". It seems a perfectly reasonable interpretation to say that
>>> assignment with a data statement means "=", in which case
>>> initial-data-target cannot be used because it is only specified to the
>>> right of "=>". That said, your interpretation seems equally valid,
>>> provided we are extending the data statement to provide pointer
>>> assignment. I consider the data statement to be somewhat archaic, and
>>> would be disappointed at it being extended when the second example is so
>>> much cleaner.
>> Same here with the disappointment.  Well, I'm subscribed to
>> the J3 mailing list.  I suppose I can send an email to the
>> list and ask.  I'll also hunt around for the J3 paper, which
>> provided the rationale and modification.
> Well, I found N1828.pdf.  This is John Reid's "The new features
> of Fortran 2008".   It has an entry for
>
>    5.5 Pointer initialization
>
>    A pointer may be initially associated with a target with the
>    save attribute:
>         type (entry), target, save :: bottom
>         type (entry), pointer :: top => bottom
>
>    and a pointer component may be default initialized as associated
>    with a target.
>
> There is no mention of DATA statement and initial-data-target change.
>
After some consideration on the matter, I realize my statement about 
initial-data-target is on very shaky ground because it does not make 
sense that it cannot be used, yet is named as being permitted within a 
data statement. Since initial-data-target only ever occurs to the right 
of "=>" I have to now submit that the extension to "=>" has been made 
like it or not. This seems to be the only clue that pointer assignment 
is allowed in this context. I note that the data statement does not 
appear in any examples of pointer assignment in the F2008 standard.




More information about the Fortran mailing list